-
Notifications
You must be signed in to change notification settings - Fork 39.6k
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
Propagate kubeadm dual-stack feature-gate to all k8s components #80531
Propagate kubeadm dual-stack feature-gate to all k8s components #80531
Conversation
Hi @Arvinderpal. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions 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/test-infra repository. |
@neolit123 @yastij @fabriziopandini @aojea |
/assign |
0556136
to
86be728
Compare
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 @Arvinderpal
added minor comments, but overall this is looking good.
@@ -102,6 +105,11 @@ func SetNodeRegistrationDynamicDefaults(cfg *kubeadmapi.NodeRegistrationOptions, | |||
klog.V(1).Infof("detected and using CRI socket: %s", cfg.CRISocket) | |||
} | |||
|
|||
if isDualStack { |
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.
can be:
if features.Enabled(cfg.ClusterConfiguration.FeatureGates, features.IPv6DualStack) {
to avoid passing the isDualStack
arg
[1]
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.
That won't work since we pass in cfg *kubeadmapi.NodeRegistrationOptions
and not ClusterConfiguration
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.
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.
This is not the place to do the feature gate patching for the kubelet. The correct place is buildKubeletArgMap
:
func buildKubeletArgMap(opts kubeletFlagsOpts) map[string]string { |
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.
@rosti I see a problem with how BuildArgumentListFromMap
works today -- it does not handle comma separated fields like "feature-gates", since it does a simple overwrite of default values with user specified values. For example, if we set IPv6DualStack=true in base, then that will be overwritten if the user has specified some additional feature-gates in KubeletExtraArgs
.
We have a couple of options:
- Make
BuildArgumentListFromMap
capable of "merging" fields like feature-gates rather than simple key/value overwrite. We would do something like this:
for k, v := range overrideArguments {
if k == "feature-gates" && len(argsMap[k]) > 0{
argsMap[k] += "," + v
}else{
argsMap[k] = v
}
}
- Modify top-level funcs like
WriteKubeletDynamicEnvFile
so that they perform the merge on feature-gates. This would require updating theargList
list returned byBuildArgumentListFromMap
. This is not ideal, IMO.
We could also just leave the code in the higher-level funcs as it is in the current PR.
I'll wait for you feedback before proceeding. Thanks.
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.
Let's keep things simple for now and just allow the users to overwrite the whole of the feature-gates
flags if they wish.
Either way, this is going to be documented as part of the feature gate documentation.
Another possibility is to modify BuildArgumentListFromMap
to warn on overwrites.
Certainly, we should not do this in the dynamic defaulting code.
@fabriziopandini @neolit123 WDYT?
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 think that @rosti is correct here that dynamic defaults is not the best place.
Let's keep things simple for now and just allow the users to overwrite the whole of the feature-gates flags if they wish.
makes sense to me.
passing the dual stack feature gate to the kubelet will be implicit (if the kubeadm FG is on). so if the user provides their own feature-gates for the kubelet extraArgs, this should overwrite the implicit gate but should also show a warning.
Either way, this is going to be documented as part of the feature gate documentation.
we might add a sentence about overrides, yes.
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.
Done.
/retest |
86be728
to
ec15c65
Compare
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.
@neolit123 Thanks for the feedback. Please see my comments.
@@ -102,6 +105,11 @@ func SetNodeRegistrationDynamicDefaults(cfg *kubeadmapi.NodeRegistrationOptions, | |||
klog.V(1).Infof("detected and using CRI socket: %s", cfg.CRISocket) | |||
} | |||
|
|||
if isDualStack { |
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.
That won't work since we pass in cfg *kubeadmapi.NodeRegistrationOptions
and not ClusterConfiguration
/test pull-kubernetes-integration |
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 @Arvinderpal !
However, we need the feature gate propagation to be done at a more lower code level, than in the config dynamic defaulting code.
@@ -102,6 +105,11 @@ func SetNodeRegistrationDynamicDefaults(cfg *kubeadmapi.NodeRegistrationOptions, | |||
klog.V(1).Infof("detected and using CRI socket: %s", cfg.CRISocket) | |||
} | |||
|
|||
if isDualStack { |
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.
This is not the place to do the feature gate patching for the kubelet. The correct place is buildKubeletArgMap
:
func buildKubeletArgMap(opts kubeletFlagsOpts) map[string]string { |
ec15c65
to
56ad9b6
Compare
56ad9b6
to
6a58483
Compare
@rosti @neolit123 Thank you for the feedback. I have made the changes requested. |
6a58483
to
6082e7f
Compare
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 the update
/lgtm
approve on @rosti
looks like some build tests are failing. |
6082e7f
to
bec0017
Compare
bec0017
to
6524f81
Compare
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.
just some nits, also +1 on the previous feedback @rosti
enabled, present := cfg.FeatureGates[features.IPv6DualStack] | ||
if present && enabled { | ||
defaultArguments["feature-gates"] = features.IPv6DualStack + "=true" | ||
} else if present && !enabled { |
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.
why not just else
? (the remaining case is !present
)
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.
[1] Ideally, we would like to cover the present==true
case. So something like this should work:
if present {
defaultArguments["feature-gates"] = fmt.Sprintf("%s=%t", features.IPv6DualStack, enabled)
}
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.
Done!
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 @Arvinderpal !
Leaving final lgtm to @yastij or @neolit123
/approve
enabled, present := cfg.FeatureGates[features.IPv6DualStack] | ||
if present && enabled { | ||
defaultArguments["feature-gates"] = features.IPv6DualStack + "=true" | ||
} else if present && !enabled { |
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.
[1] Ideally, we would like to cover the present==true
case. So something like this should work:
if present {
defaultArguments["feature-gates"] = fmt.Sprintf("%s=%t", features.IPv6DualStack, enabled)
}
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Arvinderpal, rosti 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 |
progagates the kubeadm FG to the individual k8scomponents on the control-plane node. * Note: Users who want to join worker nodes to the cluster will have to specify the dual-stack FG to kubelet using the nodeRegistration.kubeletExtraArgs option as part of their join config. Alternatively, they can use KUBELET_EXTRA_ARGS. kubeadm FG: kubernetes/kubeadm#1612
6524f81
to
585ef37
Compare
/lgtm |
/retest |
/retest Review the full test history for this PR. Silence the bot with an |
2 similar comments
/retest Review the full test history for this PR. Silence the bot with an |
/retest Review the full test history for this PR. Silence the bot with an |
@Arvinderpal: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions 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/test-infra repository. I understand the commands that are listed here. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR propagates the kubeadm feature-gate, if set in ClusterConfiguration, to the all individual kubernetes components on the control-plane node.
For worker nodes, users will have to specify the dual-stack feature-gate to kubelet using the nodeRegistration.kubeletExtraArgs option as part of their join config. Alternatively, they can use KUBELET_EXTRA_ARGS as well.
Which issue(s) this PR fixes:
This addresses one of the TODO items in the dual-stack kubeadm tracker ticket: kubernetes/kubeadm#1612
It's a follow up to the initial kubeadm dual-stack feature-gate PR: #80145
Special notes for your reviewer:
Does this PR introduce a user-facing change?: