Skip to content

Commit

Permalink
Move the ca-annotation to the utils file
Browse files Browse the repository at this point in the history
  • Loading branch information
hardikdr committed Aug 26, 2020
1 parent b99e8a8 commit 3a557bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
12 changes: 0 additions & 12 deletions pkg/apis/machine/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
4 changes: 2 additions & 2 deletions pkg/controller/deployment_rolling.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions pkg/controller/deployment_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3a557bb

Please sign in to comment.