Skip to content

ROUGH DRAFT - ClusterClass User Managed Worker Upgrades #12515

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/core/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,10 @@ type MachineDeploymentTopology struct {
// +kubebuilder:validation:MaxLength=256
Class string `json:"class"`

// version is the Kubernetes version of the worker group, can only be used if auto-upgrade is disabled.
// +optional
Version *string `json:"version,omitempty"`

// name is the unique identifier for this MachineDeploymentTopology.
// The value is used with other unique identifiers to create a MachineDeployment's Name
// (e.g. cluster's name, etc). In case the name is greater than the allowed maximum length,
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions api/core/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions api/core/v1beta1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/core/v1beta2/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,12 @@ type MachineDeploymentTopology struct {
// +optional
Metadata ObjectMeta `json:"metadata,omitempty,omitzero"`

//TODO: validation with auto-upgrade

// version is the Kubernetes version of the worker group, can only be used if auto-upgrade is disabled.
// +optional
Version *string `json:"version,omitempty"`

// class is the name of the MachineDeploymentClass used to create the set of worker nodes.
// This should match one of the deployment classes defined in the ClusterClass object
// mentioned in the `Cluster.Spec.Class` field.
Expand Down
5 changes: 5 additions & 0 deletions api/core/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions api/core/v1beta2/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bootstrap/kubeadm/config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ spec:
template:
spec:
containers:
- image: gcr.io/k8s-staging-cluster-api/kubeadm-bootstrap-controller:main
- image: igor-test-bootstrap-arm64:dev
name: manager
10 changes: 10 additions & 0 deletions config/crd/bases/cluster.x-k8s.io_clusters.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ spec:
template:
spec:
containers:
- image: gcr.io/k8s-staging-cluster-api/cluster-api-controller:main
- image: igor-test-arm64:dev
name: manager
7 changes: 7 additions & 0 deletions exp/topology/desiredstate/desired_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ func (g *generator) Generate(ctx context.Context, s *scope.Scope) (*scope.Cluste
}
}

//TODO: remove MD from here if using user-managed

// Mark all the MachineDeployments that are currently upgrading.
// This captured information is used for:
// - Building the TopologyReconciled condition.
Expand Down Expand Up @@ -934,6 +936,11 @@ func (g *generator) computeMachineDeployment(ctx context.Context, s *scope.Scope
// the current control plane and the version defined in the topology.
func (g *generator) computeMachineDeploymentVersion(s *scope.Scope, machineDeploymentTopology clusterv1.MachineDeploymentTopology, currentMDState *scope.MachineDeploymentState) string {
desiredVersion := s.Blueprint.Topology.Version
if machineDeploymentTopology.Version != nil {
// Return early if the auto-upgrade is disabled.
return *machineDeploymentTopology.Version
}

// If creating a new machine deployment, mark it as pending if the control plane is not
// yet stable. Creating a new MD while the control plane is upgrading can lead to unexpected race conditions.
// Example: join could fail if the load balancers are slow in detecting when CP machines are
Expand Down
1 change: 1 addition & 0 deletions internal/api/core/v1alpha4/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/controllers/machineset/machineset_preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func (r *Reconciler) kubeadmVersionPreflightCheck(cpSemver, msSemver semver.Vers
return nil
}

// TODO: this preflight check should always be skipped for MachineSets that are removed from topology auto version mgmt
func (r *Reconciler) controlPlaneVersionPreflightCheck(cluster *clusterv1.Cluster, cpVersion, msVersion string) preflightCheckErrorMessage {
if feature.Gates.Enabled(feature.ClusterTopology) && cluster.Spec.Topology != nil {
if cpVersion != msVersion {
Expand Down
Loading