From 3a557bbf6fc38ef5ade63b869364dff462d18558 Mon Sep 17 00:00:00 2001 From: Hardik Dodiya Date: Wed, 26 Aug 2020 12:25:20 +0530 Subject: [PATCH] Move the ca-annotation to the utils file --- pkg/apis/machine/v1alpha1/shared_types.go | 12 ------------ pkg/controller/deployment_rolling.go | 4 ++-- pkg/controller/deployment_util.go | 8 ++++++++ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/pkg/apis/machine/v1alpha1/shared_types.go b/pkg/apis/machine/v1alpha1/shared_types.go index 5b24873e9..d1d56f6ab 100644 --- a/pkg/apis/machine/v1alpha1/shared_types.go +++ b/pkg/apis/machine/v1alpha1/shared_types.go @@ -72,15 +72,3 @@ type MachineSummary struct { // OwnerRef OwnerRef string `json:"ownerRef,omitempty"` } - -const ( - // ClusterAutoscalerScaleDownDisabledAnnotationKey annotation to disable the scale-down of the nodes. - ClusterAutoscalerScaleDownDisabledAnnotationKey = "cluster-autoscaler.kubernetes.io/scale-down-disabled" - // ClusterAutoscalerScaleDownDisabledAnnotationValue annotation to disable the scale-down of the nodes. - ClusterAutoscalerScaleDownDisabledAnnotationValue = "True" - - // ClusterAutoscalerScaleDownDisabledAnnotationByMCMKey annotation to disable the scale-down of the nodes. - ClusterAutoscalerScaleDownDisabledAnnotationByMCMKey = "cluster-autoscaler.kubernetes.io/scale-down-disabled-by-mcm" - // ClusterAutoscalerScaleDownDisabledAnnotationByMCMValue annotation to disable the scale-down of the nodes. - ClusterAutoscalerScaleDownDisabledAnnotationByMCMValue = "True" -) diff --git a/pkg/controller/deployment_rolling.go b/pkg/controller/deployment_rolling.go index 5af377474..a3542391d 100644 --- a/pkg/controller/deployment_rolling.go +++ b/pkg/controller/deployment_rolling.go @@ -46,10 +46,10 @@ var ( func (dc *controller) rolloutRolling(d *v1alpha1.MachineDeployment, isList []*v1alpha1.MachineSet, machineMap map[types.UID]*v1alpha1.MachineList) error { clusterAutoscalerScaleDownAnnotations := make(map[string]string) - clusterAutoscalerScaleDownAnnotations[v1alpha1.ClusterAutoscalerScaleDownDisabledAnnotationKey] = v1alpha1.ClusterAutoscalerScaleDownDisabledAnnotationValue + clusterAutoscalerScaleDownAnnotations[ClusterAutoscalerScaleDownDisabledAnnotationKey] = ClusterAutoscalerScaleDownDisabledAnnotationValue // We do this avoid accidentally deleting the user provided annotations. - clusterAutoscalerScaleDownAnnotations[v1alpha1.ClusterAutoscalerScaleDownDisabledAnnotationByMCMKey] = v1alpha1.ClusterAutoscalerScaleDownDisabledAnnotationByMCMValue + clusterAutoscalerScaleDownAnnotations[ClusterAutoscalerScaleDownDisabledAnnotationByMCMKey] = ClusterAutoscalerScaleDownDisabledAnnotationByMCMValue newIS, oldISs, err := dc.getAllMachineSetsAndSyncRevision(d, isList, machineMap, true) if err != nil { diff --git a/pkg/controller/deployment_util.go b/pkg/controller/deployment_util.go index bdc9f61ca..79e48f3a8 100644 --- a/pkg/controller/deployment_util.go +++ b/pkg/controller/deployment_util.go @@ -109,6 +109,14 @@ const ( // PreferNoScheduleKey is used to identify machineSet nodes on which PreferNoSchedule taint is added on // older machineSets during a rolling update PreferNoScheduleKey = "deployment.machine.sapcloud.io/prefer-no-schedule" + // ClusterAutoscalerScaleDownDisabledAnnotationKey annotation to disable the scale-down of the nodes. + ClusterAutoscalerScaleDownDisabledAnnotationKey = "cluster-autoscaler.kubernetes.io/scale-down-disabled" + // ClusterAutoscalerScaleDownDisabledAnnotationValue annotation to disable the scale-down of the nodes. + ClusterAutoscalerScaleDownDisabledAnnotationValue = "True" + // ClusterAutoscalerScaleDownDisabledAnnotationByMCMKey annotation to disable the scale-down of the nodes. + ClusterAutoscalerScaleDownDisabledAnnotationByMCMKey = "cluster-autoscaler.kubernetes.io/scale-down-disabled-by-mcm" + // ClusterAutoscalerScaleDownDisabledAnnotationByMCMValue annotation to disable the scale-down of the nodes. + ClusterAutoscalerScaleDownDisabledAnnotationByMCMValue = "True" // RollbackRevisionNotFound is not found rollback event reason RollbackRevisionNotFound = "DeploymentRollbackRevisionNotFound"