File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -109,5 +109,20 @@ func (r *OpenTelemetryCollector) validateCRDSpec() error {
109
109
}
110
110
}
111
111
112
+ // validate autoscale with horizontal pod autoscaler
113
+ if r .Spec .Autoscale != nil && * r .Spec .Autoscale {
114
+ if r .Spec .Replicas != nil {
115
+ return fmt .Errorf ("the OpenTelemetry Spec autoscale configuration is incorrect, replicas should be nil" )
116
+ }
117
+
118
+ if r .Spec .MaxReplicas == nil || * r .Spec .MaxReplicas < int32 (1 ) {
119
+ return fmt .Errorf ("the OpenTelemetry Spec autoscale configuration is incorrect, maaxReplicas should be defined and more than one" )
120
+ }
121
+
122
+ if r .Spec .MinReplicas != nil && * r .Spec .MinReplicas > * r .Spec .MaxReplicas {
123
+ return fmt .Errorf ("the OpenTelemetry Spec autoscale configuration is incorrect, minReplicas could be more than maxReplicas" )
124
+ }
125
+ }
126
+
112
127
return nil
113
128
}
You can’t perform that action at this time.
0 commit comments