Repository navigation
Report a stopped CloudStack instance as shut down - #120
bhouse-nexthop wants to merge 1 commit into
Conversation
InstanceShutdown and InstanceShutdownByProviderID returned NotImplemented. The node lifecycle controller could not tell a node whose VM is stopped from one that is only unreachable, so it never applied the node.cloudprovider.kubernetes.io/shutdown taint. With InstancesV2 it also logged the NotImplemented error for every NotReady node on each monitor period. Both now look up the instance and report it shut down when its state is Stopped. Stopping is not reported: the guest may still be running. InstanceShutdown finds the instance by node name, as InstanceExists does, so both checks look at the same VM. Signed-off-by: Brad House <bhouse@nexthop.ai>
|
Tested on a KVM lab with Apache CloudStack (a main / 24.0 build), Ceph RBD primary storage, and CKS clusters on Kubernetes 1.33.1. The CCM was deployed with the
The taint time follows the node monitor grace period (50 s on Kubernetes 1.33) plus one CCM monitor period. Seen while testing, not caused by this change: the CCM runs as a single replica and its control-plane placement in the manifest is a preference, so the pod can be scheduled on a worker. In one run it was on the worker that was stopped, and no taint could be set until that worker came back. |
InstanceShutdownandInstanceShutdownByProviderIDreturnedNotImplemented. When a node's VM was stopped in CloudStack, the node lifecycle controller could not tell it from an unreachable node: it never appliednode.cloudprovider.kubernetes.io/shutdown, and on the InstancesV2 path it loggederror checking if node <name> is shutdown: unimplementedfor every NotReady node on each monitor period.Both now look up the instance and report it shut down when its state is
Stopped.StoppedunimplementedStarting,Running,Stopping,MigratingunimplementedunimplementedInstanceNotFoundStoppingis not shut down: the guest may still be running and writing to its volumes.InstanceShutdownfinds the instance by node name, asInstanceExistsdoes. The controller calls both on the same node, so they look at the same VM, and it works on nodes without a provider ID.Testing
make test: all tests pass, 0 failures; 18 new subtests: state mapping, node unknown to CloudStack, API errors, instance deleted between lookups, andInstanceShutdownByProviderIDin the existing lookup table (project scoping, scheme stripping, not found, API error).make lint(golangci-lint 2.15.0): 0 issues.Not done
NoScheduleonly. It doesn't release a stopped node's volumes; that is Kubernetes'node.kubernetes.io/out-of-servicetaint.InstanceExistsstill returns an error rather thanfalsewhen the node's VM is gone. That is a separate change.Fixes #119