clusterctl fails with a nil pointer if no controlPlaneRef set in Cluster #8603
Labels
kind/bug
Categorizes issue or PR as related to a bug.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
What steps did you take and what happened?
Usually this should never happen. During a migration from a non-CAPI-managed cluster to a CAPI managed cluster I forgot to add the control plane reference in the Cluster object. This results in a nil pointer as the following code expects at least 1 control plane
cluster-api/cmd/clusterctl/client/tree/discovery.go
Lines 94 to 98 in 7edbaf0
To reproduce we can simply remove the
controlPlaneRef
from theCluster
and run aclusterctl describe cluster
.What did you expect to happen?
At least an error that no control plane reference is set. Alternatively, no valid KCP can be displayed via
clusterctl describe cluster
.Cluster API version
main
branchKubernetes version
No response
Anything else you would like to add?
/
Label(s) to be applied
/kind bug
One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels.
The text was updated successfully, but these errors were encountered: