@@ -134,7 +134,7 @@ func (r *OpenTelemetryCollector) validateCRDSpec() error {
134
134
// validate autoscale with horizontal pod autoscaler
135
135
if r .Spec .MaxReplicas != nil {
136
136
if * r .Spec .MaxReplicas < int32 (1 ) {
137
- return fmt .Errorf ("the OpenTelemetry Spec autoscale configuration is incorrect, maxReplicas should be defined and more than one " )
137
+ return fmt .Errorf ("the OpenTelemetry Spec autoscale configuration is incorrect, maxReplicas should be defined and one or more " )
138
138
}
139
139
140
140
if r .Spec .Replicas != nil && * r .Spec .Replicas > * r .Spec .MaxReplicas {
@@ -150,15 +150,17 @@ func (r *OpenTelemetryCollector) validateCRDSpec() error {
150
150
}
151
151
152
152
if r .Spec .Autoscaler != nil && r .Spec .Autoscaler .Behavior != nil {
153
- if r .Spec .Autoscaler .Behavior .ScaleDown != nil && * r .Spec .Autoscaler .Behavior .ScaleDown .StabilizationWindowSeconds < int32 (1 ) {
153
+ if r .Spec .Autoscaler .Behavior .ScaleDown != nil && r .Spec .Autoscaler .Behavior .ScaleDown .StabilizationWindowSeconds != nil &&
154
+ * r .Spec .Autoscaler .Behavior .ScaleDown .StabilizationWindowSeconds < int32 (1 ) {
154
155
return fmt .Errorf ("the OpenTelemetry Spec autoscale configuration is incorrect, scaleDown should be one or more" )
155
156
}
156
157
157
- if r .Spec .Autoscaler .Behavior .ScaleUp != nil && * r .Spec .Autoscaler .Behavior .ScaleUp .StabilizationWindowSeconds < int32 (1 ) {
158
+ if r .Spec .Autoscaler .Behavior .ScaleUp != nil && r .Spec .Autoscaler .Behavior .ScaleUp .StabilizationWindowSeconds != nil &&
159
+ * r .Spec .Autoscaler .Behavior .ScaleUp .StabilizationWindowSeconds < int32 (1 ) {
158
160
return fmt .Errorf ("the OpenTelemetry Spec autoscale configuration is incorrect, scaleUp should be one or more" )
159
161
}
160
162
}
161
- if r .Spec .Autoscaler .TargetCPUUtilization != nil && (* r .Spec .Autoscaler .TargetCPUUtilization < int32 (1 ) || * r .Spec .Autoscaler .TargetCPUUtilization > int32 (99 )) {
163
+ if r .Spec .Autoscaler != nil && r . Spec . Autoscaler .TargetCPUUtilization != nil && (* r .Spec .Autoscaler .TargetCPUUtilization < int32 (1 ) || * r .Spec .Autoscaler .TargetCPUUtilization > int32 (99 )) {
162
164
return fmt .Errorf ("the OpenTelemetry Spec autoscale configuration is incorrect, targetCPUUtilization should be greater than 0 and less than 100" )
163
165
}
164
166
0 commit comments