From 81aa971a0e82731e4acbd32268066c15931a0faf Mon Sep 17 00:00:00 2001 From: Kevin Earls Date: Fri, 15 Jul 2022 14:15:53 +0200 Subject: [PATCH] Respond to comments Signed-off-by: Kevin Earls --- apis/v1alpha1/opentelemetrycollector_types.go | 2 +- apis/v1alpha1/opentelemetrycollector_webhook.go | 2 +- bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml | 3 ++- config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml | 3 ++- pkg/collector/reconcile/horizontalpodautoscaler_test.go | 1 - tests/e2e/autoscale/00-install.yaml | 1 - 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apis/v1alpha1/opentelemetrycollector_types.go b/apis/v1alpha1/opentelemetrycollector_types.go index 5758d241f3..5979695bb9 100644 --- a/apis/v1alpha1/opentelemetrycollector_types.go +++ b/apis/v1alpha1/opentelemetrycollector_types.go @@ -37,7 +37,7 @@ type OpenTelemetryCollectorSpec struct { // +optional Replicas *int32 `json:"replicas,omitempty"` - // MinReplicas sets a lower bound to the autoscaling feature. + // MinReplicas sets a lower bound to the autoscaling feature. It must be at least 1 // +optional MinReplicas *int32 `json:"minReplicas,omitempty"` diff --git a/apis/v1alpha1/opentelemetrycollector_webhook.go b/apis/v1alpha1/opentelemetrycollector_webhook.go index 9e6b07d018..6a4b1e936f 100644 --- a/apis/v1alpha1/opentelemetrycollector_webhook.go +++ b/apis/v1alpha1/opentelemetrycollector_webhook.go @@ -126,7 +126,7 @@ func (r *OpenTelemetryCollector) validateCRDSpec() error { } if r.Spec.MinReplicas != nil && *r.Spec.MinReplicas < int32(1) { - return fmt.Errorf("the OpenTelemetry Spec autoscale configuration is incorrect, minReplicas should be more than one") + return fmt.Errorf("the OpenTelemetry Spec autoscale configuration is incorrect, minReplicas should be one or more") } } diff --git a/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml index c7e4f91952..f3b5acbde5 100644 --- a/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml +++ b/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml @@ -224,7 +224,8 @@ spec: format: int32 type: integer minReplicas: - description: MinReplicas sets a lower bound to the autoscaling feature. + description: MinReplicas sets a lower bound to the autoscaling feature. It + must be at least 1 format: int32 type: integer mode: diff --git a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml index c8420eb8a2..2c16d8bd6f 100644 --- a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml +++ b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml @@ -222,7 +222,8 @@ spec: format: int32 type: integer minReplicas: - description: MinReplicas sets a lower bound to the autoscaling feature. + description: MinReplicas sets a lower bound to the autoscaling feature. It + must be at least 1 format: int32 type: integer mode: diff --git a/pkg/collector/reconcile/horizontalpodautoscaler_test.go b/pkg/collector/reconcile/horizontalpodautoscaler_test.go index 4c0b9f967e..62b901da37 100644 --- a/pkg/collector/reconcile/horizontalpodautoscaler_test.go +++ b/pkg/collector/reconcile/horizontalpodautoscaler_test.go @@ -52,7 +52,6 @@ func TestExpectedHPA(t *testing.T) { maxReplicas := int32(3) updateParms := paramsWithHPA() updateParms.Instance.Spec.Replicas = &minReplicas - updateParms.Instance.Spec.Replicas = &minReplicas updateParms.Instance.Spec.MaxReplicas = &maxReplicas updatedHPA := collector.HorizontalPodAutoscaler(updateParms.Config, logger, updateParms.Instance) diff --git a/tests/e2e/autoscale/00-install.yaml b/tests/e2e/autoscale/00-install.yaml index ea822b62e8..a9b54f4c9a 100644 --- a/tests/e2e/autoscale/00-install.yaml +++ b/tests/e2e/autoscale/00-install.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: simplest spec: - replicas: 1 minReplicas: 1 maxReplicas: 2 resources: