Skip to content

Commit 40b2576

Browse files
committed
removed unused struct
Signed-off-by: Omer Aplatony <[email protected]>
1 parent 549ce7b commit 40b2576

File tree

1 file changed

+1
-21
lines changed
  • vertical-pod-autoscaler/pkg/admission-controller/resource/vpa

1 file changed

+1
-21
lines changed

vertical-pod-autoscaler/pkg/admission-controller/resource/vpa/handler.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,6 @@ import (
3434
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/utils/metrics/admission"
3535
)
3636

37-
var (
38-
possibleUpdateModes = map[vpa_types.UpdateMode]interface{}{
39-
vpa_types.UpdateModeOff: struct{}{},
40-
vpa_types.UpdateModeInitial: struct{}{},
41-
vpa_types.UpdateModeRecreate: struct{}{},
42-
vpa_types.UpdateModeAuto: struct{}{},
43-
vpa_types.UpdateModeInPlaceOrRecreate: struct{}{},
44-
}
45-
46-
possibleScalingModes = map[vpa_types.ContainerScalingMode]interface{}{
47-
vpa_types.ContainerScalingModeAuto: struct{}{},
48-
vpa_types.ContainerScalingModeOff: struct{}{},
49-
}
50-
)
51-
5237
// resourceHandler builds patches for VPAs.
5338
type resourceHandler struct {
5439
preProcessor PreProcessor
@@ -127,12 +112,6 @@ func ValidateVPA(vpa *vpa_types.VerticalPodAutoscaler, isCreate bool) error {
127112

128113
if vpa.Spec.ResourcePolicy != nil {
129114
for _, policy := range vpa.Spec.ResourcePolicy.ContainerPolicies {
130-
mode := policy.Mode
131-
if mode != nil {
132-
if _, found := possibleScalingModes[*mode]; !found {
133-
return fmt.Errorf("unexpected Mode value %s", *mode)
134-
}
135-
}
136115
for resource, min := range policy.MinAllowed {
137116
if err := validateResourceResolution(resource, min); err != nil {
138117
return fmt.Errorf("MinAllowed: %v", err)
@@ -149,6 +128,7 @@ func ValidateVPA(vpa *vpa_types.VerticalPodAutoscaler, isCreate bool) error {
149128
}
150129
}
151130
ControlledValues := policy.ControlledValues
131+
mode := policy.Mode
152132
if mode != nil && ControlledValues != nil {
153133
if *mode == vpa_types.ContainerScalingModeOff && *ControlledValues == vpa_types.ContainerControlledValuesRequestsAndLimits {
154134
return fmt.Errorf("controlledValues shouldn't be specified if container scaling mode is off.")

0 commit comments

Comments
 (0)