-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add kubernetes-version/injectKubernetesVersion to Metadata #360
base: main
Are you sure you want to change the base?
Add kubernetes-version/injectKubernetesVersion to Metadata #360
Conversation
🚀 e2e tests runWe add labels to the PRs to control the e2e test runs by running specific tests and skipping some test contexts,
ℹ️ Ask a |
pkg/cloudinit/metadata.go
Outdated
@@ -32,12 +35,14 @@ type Metadata struct { | |||
} | |||
|
|||
// NewMetadata returns a new Metadata object. | |||
func NewMetadata(instanceID, hostname string, injectProviderID bool) *Metadata { | |||
func NewMetadata(instanceID, hostname string, kubernetesVersion string, injectProviderID bool, injectKubernetesVersion bool) *Metadata { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we do without both kubernetesVersion
and injectKubernetesVersion
? You could set BaseCloudInitData.KubernetesVersionInjection
depending on whether kubernetesVersion
is unset (say, empty string, or nil pointer).
If not, I would prefer the two args be kept together, like so
func NewMetadata(instanceID, hostname string, injectProviderID bool, injectKubernetesVersion bool, kubernetesVersion string) *Metadata {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback!
I have removed the injectKubernetesVersion
field. The kubernetes-version
will now be injected into the metadata if spec.version
is set on the machine.
I had to add a new argument to NewMetadata
because I don't have access to the MachineScope
there and don't know of any other way to get the Kubernetes version here.
What do you think of the new, much simpler implementation? I removed the draft flag because I think it is ready now. I have successfully tested the implementation on our infrastructure.
065a48f
to
7a2a383
Compare
Quality Gate failedFailed conditions |
Description of changes:
It would be very helpful to have access to the Kubernetes version specified in a machine's
spec.version
in the cloud-init/ignition metadata. With this information, it is possible to install Kubernetes version specific resources in cloud-init/ignition.I used this PR as a template, but I'm not sure if the way to control the injection is particularly elegant.
I would suggest injecting the field without a flag in the default or always passing the value of
MetadataSettings
completely tocloudinit.NewMetadata
so that you don't have to add another argument for each flag.I would be very happy to receive feedback from the maintainers on this suggestion and would then also carry out the desired implementation.
Testing performed:
We have tested this with the following
preKubeadmCommands
: