From a8fecff66f972815653fa038c8466facbb4ec123 Mon Sep 17 00:00:00 2001 From: Cecile Robert-Michon Date: Thu, 3 Dec 2020 16:06:40 -0700 Subject: [PATCH] :bug: Remove unused MachinePool deployment strategy --- .../exp.cluster.x-k8s.io_machinepools.yaml | 23 ------------- exp/api/v1alpha3/zz_generated.conversion.go | 32 +++++++++++++------ exp/api/v1alpha4/machinepool_types.go | 5 --- exp/api/v1alpha4/zz_generated.deepcopy.go | 5 --- 4 files changed, 23 insertions(+), 42 deletions(-) diff --git a/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml b/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml index 8e6ec82ec6a2..1b5a6eee6978 100644 --- a/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml +++ b/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml @@ -394,29 +394,6 @@ spec: description: Number of desired machines. Defaults to 1. This is a pointer to distinguish between explicit zero and not specified. format: int32 type: integer - strategy: - description: The deployment strategy to use to replace existing machine instances with new ones. - properties: - rollingUpdate: - description: Rolling update config params. Present only if MachineDeploymentStrategyType = RollingUpdate. - properties: - maxSurge: - anyOf: - - type: integer - - type: string - description: 'The maximum number of machines that can be scheduled above the desired number of machines. Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 1. Example: when this is set to 30%, the new MachineSet can be scaled up immediately when the rolling update starts, such that the total number of old and new machines do not exceed 130% of desired machines. Once old machines have been killed, new MachineSet can be scaled up further, ensuring that total number of machines running at any time during the update is at most 130% of desired machines.' - x-kubernetes-int-or-string: true - maxUnavailable: - anyOf: - - type: integer - - type: string - description: 'The maximum number of machines that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired machines (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 0. Example: when this is set to 30%, the old MachineSet can be scaled down to 70% of desired machines immediately when the rolling update starts. Once new machines are ready, old MachineSet can be scaled down further, followed by scaling up the new MachineSet, ensuring that the total number of machines available at all times during the update is at least 70% of desired machines.' - x-kubernetes-int-or-string: true - type: object - type: - description: Type of deployment. Currently the only supported strategy is "RollingUpdate". Default is RollingUpdate. - type: string - type: object template: description: Template describes the machines that will be created. properties: diff --git a/exp/api/v1alpha3/zz_generated.conversion.go b/exp/api/v1alpha3/zz_generated.conversion.go index f4a4a9f24b05..59c7fb12837b 100644 --- a/exp/api/v1alpha3/zz_generated.conversion.go +++ b/exp/api/v1alpha3/zz_generated.conversion.go @@ -116,7 +116,17 @@ func Convert_v1alpha4_MachinePool_To_v1alpha3_MachinePool(in *v1alpha4.MachinePo func autoConvert_v1alpha3_MachinePoolList_To_v1alpha4_MachinePoolList(in *MachinePoolList, out *v1alpha4.MachinePoolList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1alpha4.MachinePool)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha4.MachinePool, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_MachinePool_To_v1alpha4_MachinePool(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -127,7 +137,17 @@ func Convert_v1alpha3_MachinePoolList_To_v1alpha4_MachinePoolList(in *MachinePoo func autoConvert_v1alpha4_MachinePoolList_To_v1alpha3_MachinePoolList(in *v1alpha4.MachinePoolList, out *MachinePoolList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]MachinePool)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachinePool, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_MachinePool_To_v1alpha3_MachinePool(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -143,18 +163,13 @@ func autoConvert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(in *Machin if err := s.Convert(&in.Template, &out.Template, 0); err != nil { return err } - out.Strategy = (*apiv1alpha4.MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) + // WARNING: in.Strategy requires manual conversion: does not exist in peer-type out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) out.FailureDomains = *(*[]string)(unsafe.Pointer(&in.FailureDomains)) return nil } -// Convert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec is an autogenerated conversion function. -func Convert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(in *MachinePoolSpec, out *v1alpha4.MachinePoolSpec, s conversion.Scope) error { - return autoConvert_v1alpha3_MachinePoolSpec_To_v1alpha4_MachinePoolSpec(in, out, s) -} - func autoConvert_v1alpha4_MachinePoolSpec_To_v1alpha3_MachinePoolSpec(in *v1alpha4.MachinePoolSpec, out *MachinePoolSpec, s conversion.Scope) error { out.ClusterName = in.ClusterName out.Replicas = (*int32)(unsafe.Pointer(in.Replicas)) @@ -162,7 +177,6 @@ func autoConvert_v1alpha4_MachinePoolSpec_To_v1alpha3_MachinePoolSpec(in *v1alph if err := s.Convert(&in.Template, &out.Template, 0); err != nil { return err } - out.Strategy = (*apiv1alpha3.MachineDeploymentStrategy)(unsafe.Pointer(in.Strategy)) out.MinReadySeconds = (*int32)(unsafe.Pointer(in.MinReadySeconds)) out.ProviderIDList = *(*[]string)(unsafe.Pointer(&in.ProviderIDList)) out.FailureDomains = *(*[]string)(unsafe.Pointer(&in.FailureDomains)) diff --git a/exp/api/v1alpha4/machinepool_types.go b/exp/api/v1alpha4/machinepool_types.go index 06c4e5652c9a..f12c34c18927 100644 --- a/exp/api/v1alpha4/machinepool_types.go +++ b/exp/api/v1alpha4/machinepool_types.go @@ -43,11 +43,6 @@ type MachinePoolSpec struct { // Template describes the machines that will be created. Template clusterv1.MachineTemplateSpec `json:"template"` - // The deployment strategy to use to replace existing machine instances with - // new ones. - // +optional - Strategy *clusterv1.MachineDeploymentStrategy `json:"strategy,omitempty"` - // Minimum number of seconds for which a newly created machine instances should // be ready. // Defaults to 0 (machine instance will be considered available as soon as it diff --git a/exp/api/v1alpha4/zz_generated.deepcopy.go b/exp/api/v1alpha4/zz_generated.deepcopy.go index fb29fc56c782..e67e5831a7b1 100644 --- a/exp/api/v1alpha4/zz_generated.deepcopy.go +++ b/exp/api/v1alpha4/zz_generated.deepcopy.go @@ -95,11 +95,6 @@ func (in *MachinePoolSpec) DeepCopyInto(out *MachinePoolSpec) { **out = **in } in.Template.DeepCopyInto(&out.Template) - if in.Strategy != nil { - in, out := &in.Strategy, &out.Strategy - *out = new(apiv1alpha4.MachineDeploymentStrategy) - (*in).DeepCopyInto(*out) - } if in.MinReadySeconds != nil { in, out := &in.MinReadySeconds, &out.MinReadySeconds *out = new(int32)