-
Notifications
You must be signed in to change notification settings - Fork 1.4k
✨ Implement core logic for chained upgrades #12726
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -185,7 +185,16 @@ func (r *KubeadmControlPlaneReconciler) preflightChecks(ctx context.Context, con | |||||
|
||||||
if feature.Gates.Enabled(feature.ClusterTopology) { | ||||||
// Block when we expect an upgrade to be propagated for topology clusters. | ||||||
if controlPlane.Cluster.Spec.Topology.IsDefined() && controlPlane.Cluster.Spec.Topology.Version != controlPlane.KCP.Spec.Version { | ||||||
// NOTE: in case the cluster is performing an upgrade, allow creation of machines for the intermediate step. | ||||||
isUpgradeForVersion := false | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think a different name would be better |
||||||
if versions, ok := controlPlane.Cluster.GetAnnotations()[clusterv1.ClusterTopologyControlPlaneUpgradeStepAnnotation]; ok { | ||||||
v := strings.Split(versions, ",") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes it look like the annotation contains a list of versions. As far as I can tell it's just a single version (If this should be a list of versions, let's update the godoc on the annotation to mention that) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's correct, it is a version |
||||||
if len(v) > 0 { | ||||||
isUpgradeForVersion = strings.TrimSpace(v[0]) == controlPlane.KCP.Spec.Version | ||||||
} | ||||||
} | ||||||
|
||||||
if controlPlane.Cluster.Spec.Topology.IsDefined() && controlPlane.Cluster.Spec.Topology.Version != controlPlane.KCP.Spec.Version && !isUpgradeForVersion { | ||||||
logger.Info(fmt.Sprintf("Waiting for a version upgrade to %s to be propagated from Cluster.spec.topology", controlPlane.Cluster.Spec.Topology.Version)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should adjust the message here and in getPreflightMessages if we are waiting for the version from the annotation to be propagated to the CP (Ideally just set the desired version ]here on PreflightCheckResuls somehow and not recompute in getPreflightMessages) |
||||||
controlPlane.PreflightCheckResults.TopologyVersionMismatch = true | ||||||
return ctrl.Result{RequeueAfter: preflightFailedRequeueAfter}, nil | ||||||
|
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's a bit of a mismatch between const name, godoc and annotation key
Should this be:
topology.cluster.x-k8s.io/upgrade-step-control-plane-version
? (+ const name should then be aligned accordinglyLet's document the annotation in docs/book/src/reference/api/labels-and-annotations.md
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 would prefer to not surface implementations details, and establish a pattern where we should add internal. prefix to annotations that are meant to be used by CAPI only
e.g internal.topology.cluster.x-k8s.io/upgrade would be described as "This is an annotation used by CAPI internally to track upgrade steps. Name, meaning and semantics of annotation can change anytime and it should not be used outside of CAPI controllers.".
Uh oh!
There was an error while loading. Please reload this page.
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'm fine with adding internal, but maybe it would be still good to have a name that tells us what it exactly contains. Or we could json marshal that context into the value, but that's never fun :/
(also will be more helpful during troubleshooting)