diff --git a/api/v1alpha1/nats_types.go b/api/v1alpha1/nats_types.go index ddaa88e2..0933e9b4 100644 --- a/api/v1alpha1/nats_types.go +++ b/api/v1alpha1/nats_types.go @@ -125,7 +125,7 @@ type Cluster struct { // +kubebuilder:default:=3 // +kubebuilder:validation:Minimum:=1 // +kubebuilder:validation:XValidation:rule="(self%2) != 0", message="size only accepts odd numbers" - // +kubebuilder:validation:XValidation:rule="!(oldSelf > 1 && self == 1)", message="size cannot be reduced to 1 once it was >1" + // +kubebuilder:validation:XValidation:rule="!(oldSelf > 1 && self == 1)", message="cannot be set to 1 if size was greater than 1" Size int `json:"size,omitempty"` } diff --git a/config/crd/bases/operator.kyma-project.io_nats.yaml b/config/crd/bases/operator.kyma-project.io_nats.yaml index b62126ac..dc54fabb 100644 --- a/config/crd/bases/operator.kyma-project.io_nats.yaml +++ b/config/crd/bases/operator.kyma-project.io_nats.yaml @@ -83,7 +83,7 @@ spec: x-kubernetes-validations: - message: size only accepts odd numbers rule: (self%2) != 0 - - message: size cannot be reduced to 1 once it was >1 + - message: cannot be set to 1 if size was greater than 1 rule: '!(oldSelf > 1 && self == 1)' type: object jetStream: diff --git a/internal/controller/nats/integrationtests/validation/integration_test.go b/internal/controller/nats/integrationtests/validation/integration_test.go index 6a016fe2..1410a852 100644 --- a/internal/controller/nats/integrationtests/validation/integration_test.go +++ b/internal/controller/nats/integrationtests/validation/integration_test.go @@ -280,7 +280,7 @@ func Test_Validate_UpdateNATS(t *testing.T) { Size: 1, }), }, - wantErrMsg: "size cannot be reduced to 1 once it was >1", + wantErrMsg: "cannot be set to 1 if size was greater than 1", }, { name: `validation of cluster passes, if cluster.size was set to a value >1