gardener / machine-controller-manager

Declarative way of managing machines for Kubernetes cluster
Apache License 2.0
257 stars 117 forks source link

Add OS details in `machine` spec #880

Closed etiennnr closed 6 months ago

etiennnr commented 11 months ago

How to categorize this issue?

/area ops-productivity robustness /kind enhancement /priority 3

What would you like to be added: Context: I'm trying to detect shoots that are in failed state with either k8s or worker version expired. However, when a version is expired in the cloudProfile (aka later than the expiration date), the shoots yaml is automatically updated at the first maintenance period (aka max 24h after). This means that the k8s and worker version data in the shoot yaml is not "trustable" for my use case.

So I have to go get that data from either the seed or the shoot itself. It's pretty easy for the k8s version (simply get the /version of the shoot's kapi) but it's proving to be much harder than expected for the workers...

In order to compare the versions with the cloudProfile, I need both the OS name and version. So I first tried looking at the nodes directly. There's the .status.nodeInfo.osImage but that data is a string (eg. Garden Linux 934.8) so I'd have to create a regex that supports all ways of displaying the OS name + version. Also, this is quite cumbersome, and the version is not always the same as in the cloud profile depending on the OS.

So, instead, I'd like to have that data (os name and os version) as an annotation / spec in the machine (and/or machineDeployment, machineclass, machinesets, node).

Changes will be needed in all gardener-extension-providers:-

Why is this needed: When running some reports, we want to be able to fetch the version of the actual nodes in the shoot vs what's in the cloud profile.

tedteng commented 10 months ago

I like to have a look if no objections. /assign

rishabh-11 commented 10 months ago

Post Grooming Decision:-

Two options:-

  1. Add an annotation on the machine after creation which will reflect the OS version and name.
  2. Add immutable status fields in the machine status for OS name and version.

We will go with option 1 for ease of implementation.

tedteng commented 10 months ago

Add an annotation on the machine after creation which will reflect the OS version and name.

Thanks. I will follow this option. /assign

rishabh-11 commented 9 months ago

Change in Post Grooming Decision:-

It is not possible for MCM to get the OS name and version from the current information that it has. The extension providers do have the information of os name and version via the worker custom resource. The decision is made to make a change in respective gardener extension providers to add two labels in the machine class while generating it.

rishabh-11 commented 8 months ago

/reopen as changes are not done in all extensions

tedteng commented 6 months ago

all extension PRs merged and closed

etiennnr commented 6 months ago

Since all PRs have been merged and everything has been released (except for OpenStack, which should happen within the next 2 weeks), I think we can close this issue. Thanks y'all for your support :)