syself / cluster-api-provider-hetzner

Cluster API Provider Hetzner :rocket: The best way to manage Kubernetes clusters on Hetzner, fully declarative, Kubernetes-native and with self-healing capabilities
https://caph.syself.com
Apache License 2.0
619 stars 58 forks source link

:sparkles: Add ssh keys to status and fix ssh key in secret #1317

Closed janiskemper closed 4 months ago

janiskemper commented 4 months ago

What this PR does / why we need it: In order to visualize which ssh keys have been used to provision a machine, we write the keys in the status of the HCloudMachine.

On top, we fix a bug where the "patch" call for the finalizer removed the ssh key from the spec of the HetznerCluster again, because it cannot patch the HetznerCluster.spec if a ClusterClass is used.

We add the ssh key now after the patch, so that it will still get patched at the end of the function, but can be used until then. In case of a ClusterClass we just don't have the key reflected in the spec of the HetznerCluster.

This is why we also add the list of keys to the HCloudMachine status, so that it is better visible.

TODOs: