cluster-api: CAPI won't delete Nodes in "managed" control planes because there are no control plane machines

What steps did you take and what happened: [A clear and concise description on how to REPRODUCE the bug.]

  • Create cluster with EKS providers in CAPA
  • Create some Machines
  • Delete those Machines
  • Observe nodes not going away, weird scheduling behaviors, etc

What did you expect to happen:

Deleting Machines deletes Nodes too.

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

I’m fairly certain the check here is the issue:

https://github.com/kubernetes-sigs/cluster-api/blob/feaff31a93174f79929f1264f47f8ad057577454/controllers/machine_controller.go#L379-L396

No control plane Machines in an EKS cluster.

Environment:

  • Cluster-api version: latest
  • Minikube/KIND version: v0.8
  • Kubernetes version: (use kubectl version): v1.17.9
  • OS (e.g. from /etc/os-release): Amazon Linux 2

/kind bug [One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels]

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (20 by maintainers)

Most upvoted comments

LGTM, maybe have IsExternalManagedControlPlane? Given that managed could mean a number of things

Works for me

Was thinking something like this in util.go

// IsManagedControlPlane returns a bool indicating whether the control plane referenced
// in the passed ObjectReference is a managed control plane
func IsManagedControlPlane(controlPlaneRef *corev1.ObjectReference) bool {
	controlPlane := ObjectReferenceToUnstructured(*controlPlaneRef)
	managed, found, err := unstructured.NestedBool(controlPlane.Object, "status", "managedControlPlane")
	if err != nil || !found {
		return false
	}
	return managed
}