Skip to content
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 ExtraEnvs and ImagePullSerial to KubeadmConfig #10846

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR adds ExtraEnvs and ImagePullSerial to KubeadmConfig; those fields have been added in kubeadm v1beta4 API, and thus they will be supported in Cluster with K8s >= 1.31

Which issue(s) this PR fixes:
Part of #10708

/area provider/bootstrap-kubeadm

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/provider/bootstrap-kubeadm Issues or PRs related to CAPBK cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 8, 2024
@fabriziopandini fabriziopandini force-pushed the add-new-kubeadm-v1beta4-fields branch from ef3a6e9 to fccad65 Compare July 8, 2024 18:47
@fabriziopandini fabriziopandini force-pushed the add-new-kubeadm-v1beta4-fields branch from fccad65 to 700138b Compare July 8, 2024 19:00
@fabriziopandini fabriziopandini added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jul 8, 2024
@fabriziopandini fabriziopandini changed the title [WIP] ✨ Add ExtraEnvs and ImagePullSerial to KubeadmConfig ✨ Add ExtraEnvs and ImagePullSerial to KubeadmConfig Jul 9, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 9, 2024
@sbueringer
Copy link
Member

Looks perfect, thx!!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 9, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: dff1454dc70fc4be1f941a9575422163f7186b92

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 9, 2024

// ImagePullSerial specifies if image pulling performed by kubeadm must be done serially or in parallel.
// This option takes effect only on Kubernetes >=1.31.0.
// Default: true (defaulted in kubeadm)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why do we want the default to be true for this one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubeadm defaults to true, I assume because it was the previous behavior

(cc @neolit123)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, serial is the default in kubeadm and kubelet

// Environment variables passed using ExtraEnvs will override any existing environment variables, or *_proxy environment variables that kubeadm adds by default.
// This option takes effect only on Kubernetes >=1.31.0.
// +optional
ExtraEnvs []EnvVar `json:"extraEnvs,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ExtraEnvs []EnvVar `json:"extraEnvs,omitempty"`
ExtraEnvs []corev1.EnvVar `json:"extraEnvs,omitempty"`

Do we need the extra container?

Copy link
Member

@sbueringer sbueringer Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. It aligns to what kubeadm did. Not sure why

(cc @neolit123)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i actually don't remember why. will try to dig out comments.
seems there is no need for that.

should we change it pre-release 1.31?

Copy link
Member

@neolit123 neolit123 Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, that was a wild problem related to defaulting of corev1.ExtraEnvs using internal APIs
kubernetes/kubernetes#120561
https://github.com/kubernetes/kubernetes/pull/120561/files#diff-769d744db9aca1b60fb0f12e0c34fea8523740dccd24db5f9315b284ce1b1fefR211
kubernetes/kubeadm#2927

TL;DR a new custom wrapper struct was needed so that we can have a customer defaulter and not end up with generated defaulters that import internal k/k/pkg packages and causing weird behavior (that API machinery folks can't explain)

in CAPI you can maybe work around it, but for kubeadm we have to keep it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the same struct that kubeadm uses really helps to do comparisons cross versions (and we have many of them!)

So if there are no objections, I will keep this aligned

@vincepri
Copy link
Member

vincepri commented Jul 9, 2024

/hold

for the two comments above, feel free to unhold when ready

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 9, 2024
@sbueringer
Copy link
Member

/test pull-cluster-api-e2e-main

@fabriziopandini
Copy link
Member Author

@vincepri, @neolit123 answered to both your questions (thanks!)

@sbueringer sbueringer added this to the v1.8 milestone Jul 10, 2024
Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@sbueringer
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 15, 2024
@k8s-ci-robot k8s-ci-robot merged commit 4e151e2 into kubernetes-sigs:main Jul 15, 2024
28 checks passed
@fabriziopandini fabriziopandini deleted the add-new-kubeadm-v1beta4-fields branch July 18, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/bootstrap-kubeadm Issues or PRs related to CAPBK cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants