-
Notifications
You must be signed in to change notification settings - Fork 812
Kubeadm conf v1beta4 #2907
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
base: main
Are you sure you want to change the base?
Kubeadm conf v1beta4 #2907
Conversation
Signed-off-by: William Wang <[email protected]>
Signed-off-by: William Wang <[email protected]>
as now kubekey config only support map as extraArgs Signed-off-by: William Wang <[email protected]>
|
This PR has multiple commits, and the default merge method is: squash. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: will4j The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary of ChangesHello @will4j, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request upgrades the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces support for kubeadm configuration v1beta4, which is used for Kubernetes versions v1.31.0 and higher. This involves adding new templates for kubeadm-init and kubeadm-join, and a new Go template function kubeExtraArgs to convert extraArgs from a map to the new structured list format required by v1beta4. The changes look good overall. I've made a couple of suggestions: one to improve the implementation of the new kubeExtraArgs function for better performance and robustness, and another to fix a minor style issue in the new template file.
builtin/core/roles/kubernetes/init-kubernetes/templates/kubeadm/kubeadm-init.v1beta4
Outdated
Show resolved
Hide resolved
Signed-off-by: William Wang <[email protected]>
673ed29 to
b7d1c9b
Compare
| value: /etc/kubernetes/audit/webhook.yaml | ||
| {{- end }} | ||
| {{- if .kubernetes.apiserver.extra_args | empty | not }} | ||
| {{ kubeExtraArgs .kubernetes.apiserver.extra_args | toYaml | indent 4 }} |
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.
Good!!! Please help update kubeadm-init.v1beta2, kubeadm-init.v1beta3, kubeadm-join.v1beta2, and kubeadm-join.v1beta3 accordingly.
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.
@will4j

The configuration for v3 is as follows; would it be better to retain this format?
like:
kubernetes:
apiserver:
extra_args:
- name: xxx
value: xxxThere 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.
I was intend to support both string/string format and NamedString format before. but extra_args in kubkey config default value (in builtin roles defaults) is type map, use NamedString will cause schema un match when merge kubekey config in playbook run. so I think it be better to keep use string/string format in kubekey config file for all versions. and convert to what it needed accordingly, which means, config unchanged as
kubernetes:
apiserver:
extra_args:
- name: value
and only convert to NamedString in kubeadm v1beta4 like
apiServer:
extraArgs:
- name: xxx
value: xxx
So kubekey config, kubeadm-init.v1beta2, kubeadm-init.v1beta3 etc are unchanged in this case.
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.
I am not sure if it is a good idea to make breaking change to use NamedString format in kubekey config, like
kubernetes:
apiserver:
extra_args:
- name: xxx
value: xxx
although this can support new features in v1beta4 of support duplicates.
Signed-off-by: William Wang <[email protected]>
|


What type of PR is this?
/kind feature
What this PR does / why we need it:
According to this k8s doc, the main change of kubeadm Configuration (v1beta4) is Replace the existing string/string extra argument maps with structured extra arguments that support duplicates. The change applies to ClusterConfiguration - apiServer.extraArgs, controllerManager.extraArgs, scheduler.extraArgs, etcd.local.extraArgs. Also to nodeRegistration.kubeletExtraArgs.
so I add a template function to convert extraArgs config from map to slice, keep kubekey config schema unchanged.
and use v1beta4 when kube version greater than v1.31.0
Which issue(s) this PR fixes:
Fixes #
Special notes for reviewers:
Does this PR introduced a user-facing change?
Additional documentation, usage docs, etc.: