k3s-io / cluster-api-k3s

Cluster API k3s
Apache License 2.0
149 stars 41 forks source link

Check k3s-serving secret to determine controlPlane.Status.Initialized #113

Closed anmazzotti closed 6 months ago

anmazzotti commented 6 months ago

This should fix a deadlock scenario with the controlPlane.Status.Initialized when the CloudController module is disabled and cloud-provider=external is set as kubelet arg. In this case k3s will not set Nodes.Spec.ProviderID, which is the expected behavior. The CAPI Infrastructure provider should set the ProviderID, but in order to set it, the controlPlane.Status.Initialized needs to be true first.

For reference, this is a mirror implementation from the RKE2 provider: https://github.com/rancher-sandbox/cluster-api-provider-rke2/pull/302

mogliang commented 6 months ago

Would you mind add some background for this k3s-serving? I'm not very familar with this. Btw, would you please add unit test as well?

anmazzotti commented 6 months ago

@mogliang I added a little comment to elaborate on this secret we fetch and why. Also added a bit of unit-testing on the ClusterStatus.