Skip to content

✨ Remediate unhealthy MachinePool machines #11392

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,10 @@ func Convert_v1beta1_MachinePoolSpec_To_v1beta2_MachinePoolSpec(in *MachinePoolS
return autoConvert_v1beta1_MachinePoolSpec_To_v1beta2_MachinePoolSpec(in, out, s)
}

func Convert_v1beta2_MachinePoolSpec_To_v1beta1_MachinePoolSpec(in *clusterv1.MachinePoolSpec, out *MachinePoolSpec, s apimachineryconversion.Scope) error {
return autoConvert_v1beta2_MachinePoolSpec_To_v1beta1_MachinePoolSpec(in, out, s)
}

func Convert_v1beta1_ClusterClassStatusVariableDefinition_To_v1beta2_ClusterClassStatusVariableDefinition(in *ClusterClassStatusVariableDefinition, out *clusterv1.ClusterClassStatusVariableDefinition, s apimachineryconversion.Scope) error {
if err := autoConvert_v1beta1_ClusterClassStatusVariableDefinition_To_v1beta2_ClusterClassStatusVariableDefinition(in, out, s); err != nil {
return err
Expand Down
8 changes: 8 additions & 0 deletions api/core/v1beta1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ func spokeObjectReference(in *corev1.ObjectReference, c randfill.Continue) {

func MachinePoolFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} {
return []interface{}{
hubMachinePoolSpec,
hubMachinePoolStatus,
hubMachineSpec,
spokeMachinePool,
Expand All @@ -591,6 +592,13 @@ func MachinePoolFuzzFuncs(_ runtimeserializer.CodecFactory) []interface{} {
}
}

func hubMachinePoolSpec(in *clusterv1.MachinePoolSpec, c randfill.Continue) {
c.FillNoCustom(in)

// Readded in v1beta2 with different type than in v1alpha's, no conversion possible
in.Strategy = nil
}

func hubMachinePoolStatus(in *clusterv1.MachinePoolStatus, c randfill.Continue) {
c.FillNoCustom(in)
// Always create struct with at least one mandatory fields.
Expand Down
15 changes: 15 additions & 0 deletions api/core/v1beta1/machinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,21 @@ type MachinePoolSpec struct {

// ANCHOR_END: MachinePoolSpec

// ANCHOR: MachinePoolStrategy

// MachinePoolStrategy describes how to replace existing machines
// with new ones.
type MachinePoolStrategy struct {
// remediation controls the strategy of remediating unhealthy machines
// as marked by a MachineHealthCheck. This only applies to infrastructure
// providers supporting "MachinePool Machines". For other providers,
// no remediation is done.
// +optional
Remediation *RemediationStrategy `json:"remediation,omitempty"`
}

// ANCHOR_END: MachinePoolStrategy

// ANCHOR: MachinePoolStatus

// MachinePoolStatus defines the observed state of MachinePool.
Expand Down
40 changes: 33 additions & 7 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.

20 changes: 20 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.

22 changes: 22 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.

19 changes: 19 additions & 0 deletions api/core/v1beta2/machinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,29 @@ type MachinePoolSpec struct {
// +kubebuilder:validation:items:MinLength=1
// +kubebuilder:validation:items:MaxLength=256
FailureDomains []string `json:"failureDomains,omitempty"`

// strategy defines how to replace existing machines with new ones.
// +optional
Strategy *MachinePoolStrategy `json:"strategy,omitempty"`
}

// ANCHOR_END: MachinePoolSpec

// ANCHOR: MachinePoolStrategy

// MachinePoolStrategy describes how to replace existing machines
// with new ones.
type MachinePoolStrategy struct {
// remediation controls the strategy of remediating unhealthy machines
// as marked by a MachineHealthCheck. This only applies to infrastructure
// providers supporting "MachinePool Machines". For other providers,
// no remediation is done.
// +optional
Remediation *RemediationStrategy `json:"remediation,omitempty"`
}

// ANCHOR_END: MachinePoolStrategy

// ANCHOR: MachinePoolStatus

// MachinePoolStatus defines the observed state of MachinePool.
Expand Down
25 changes: 25 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.

30 changes: 29 additions & 1 deletion api/core/v1beta2/zz_generated.openapi.go

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

33 changes: 33 additions & 0 deletions config/crd/bases/cluster.x-k8s.io_machinepools.yaml

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

Loading