✨ Add rollout strategy support for KCP#4073
Conversation
|
Hi @jan-est. Thanks for your PR. I'm waiting for a kubernetes-sigs 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. 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/test-infra repository. |
4fa622d to
915623b
Compare
|
/ok-to-test |
915623b to
3c7d3f4
Compare
3c7d3f4 to
2983b86
Compare
f0d3469 to
3a918f3
Compare
fb76378 to
3dae187
Compare
3dae187 to
0728012
Compare
abf4836 to
620a288
Compare
|
@jan-est Can you squash commits? |
df2290e to
7183044
Compare
| // We can ignore MaxUnavailable because we are enforcing health checks before we get here. | ||
| maxNodes := *kcp.Spec.Replicas + int32(kcp.Spec.RolloutStrategy.RollingUpdate.MaxSurge.IntValue()) | ||
| if status.Nodes < maxNodes { |
There was a problem hiding this comment.
Is MaxUnavailable not used anywhere in the code?
There was a problem hiding this comment.
It is not used anywhere in kubeadmControlPlane controllers code.
There was a problem hiding this comment.
If not, we should probably remove it
There was a problem hiding this comment.
We are using MaxUnavailable in webhook code
There was a problem hiding this comment.
I guess in this implementation we don't need both MaxSurge and MaxUnavailable since one is the opposite of the other. The benefit of having MaxUnavailbale is that it makes it explicit for the user that setting maxSurge to 0 means that you'll have 1 control plane at a time go down during upgrade.
Makes sense to remove it and add it in the future if we actually need it to implement a more flexible rollout.
There was a problem hiding this comment.
If we do remove it we also need to update any docs/proposal that reference it
There was a problem hiding this comment.
If we do want to keep it for UX purposes, it should probably be a calculated field, under Status
There was a problem hiding this comment.
I am +1 for removing it complete. I agree with @CecileRobertMichon that we can add it back in the future if necessary. I remove MaxUnavailable and update the proposal when this is approved and merged?
There was a problem hiding this comment.
We should possibly remove it in this same PR, so the changes go in together. +1 from me as well.
| if status.Nodes <= *kcp.Spec.Replicas { | ||
| // RolloutStrategy is currently defaulted and validated to be RollingUpdate | ||
| // We can ignore MaxUnavailable because we are enforcing health checks before we get here. | ||
| maxNodes := *kcp.Spec.Replicas + int32(kcp.Spec.RolloutStrategy.RollingUpdate.MaxSurge.IntValue()) |
There was a problem hiding this comment.
@detiber @sedefsavas @CecileRobertMichon @fabriziopandini Please double check these changes, given that you all have worked more or less on this codebase.
If we were to backport this to v1alpha3, would you foresee any issues?
7183044 to
00f3c8e
Compare
| return err | ||
| } | ||
|
|
||
| dest.Spec.RolloutStrategy = restored.Spec.RolloutStrategy |
There was a problem hiding this comment.
if we do backport to v1alpha3 wouldn't this be a problem?
There was a problem hiding this comment.
If we do backport, we need to remove this part of the code and say something like Required minimum v0.3.x version before upgrading is ...
| allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "version"), in.Spec.Version, "must be a valid semantic version")) | ||
| } | ||
|
|
||
| if in.Spec.RolloutStrategy != nil { |
There was a problem hiding this comment.
Should we error out in case in.Spec.RolloutStrategy == nil?
There was a problem hiding this comment.
Can if in.Spec.RolloutStrategy == nil ever be true? I assumed that defaulting on line 68 makes sure that the value is never nil. Or have I misunderstood?
There was a problem hiding this comment.
Given that the defaulting function could change at some point, I personally prefer to have each func self consistent (or at least to explicitly document the assumption each function relies on, especially if those assumptions depends on something somewhere else in the codebase), but this is just a nit, feel free to ignore it
There was a problem hiding this comment.
Thanks for the clarification @fabriziopandini.
| ios1 := intstr.FromInt(1) | ||
| ios0 := intstr.FromInt(0) | ||
|
|
||
| if *in.Spec.RolloutStrategy.RollingUpdate.MaxSurge == ios0 && *in.Spec.Replicas < int32(3) { |
There was a problem hiding this comment.
Should we check for RollingUpdate != nil and error out in case this is not true?
There was a problem hiding this comment.
@fabriziopandini do you see any cases where RollingUpdate != nil is not true? I assumed that defaulting on line 68 makes sure that the value is never nil. Or have I misunderstood?
|
LGTM Let's squash commits before merging |
|
/test pull-cluster-api-test-main |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
|
/lgtm |
|
/retest |
|
/lgtm |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This PR implements proposal 3857 by adding rollout strategy support for KCP. PR will enables use of
maxSurgeandmaxUnavailablefields during KCP upgrade.