From 3c87d9beff8dff6d036483cfe5e62695e12945f7 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Thu, 19 Oct 2023 13:18:00 +0000 Subject: [PATCH] crd - XValidation - remove as it appears to not fully work Change-Id: If10f4c1cb5cd581ca71b5c1c12251a2a565702ae --- api/v1/softwarefactory_types.go | 2 -- ...softwarefactory-project.io_logservers.yaml | 3 --- ...efactory-project.io_softwarefactories.yaml | 27 ------------------- roles/health-check/test-crd/tasks/main.yaml | 6 ----- 4 files changed, 38 deletions(-) diff --git a/api/v1/softwarefactory_types.go b/api/v1/softwarefactory_types.go index 95b644a2..b20a71be 100644 --- a/api/v1/softwarefactory_types.go +++ b/api/v1/softwarefactory_types.go @@ -34,8 +34,6 @@ type LetsEncryptSpec struct { } type StorageSpec struct { - //+kubebuilder:validation:Required - //+kubebuilder:validation:XValidation:rule="self >= oldSelf",message="Storage shrinking is not supported" // Storage space to allocate to the resource, expressed as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/ Size resource.Quantity `json:"size"` // Default storage class to use with Persistent Volume Claims issued by this resource. Consult your cluster's configuration to see what storage classes are available and recommended for your use case. diff --git a/config/crd/bases/sf.softwarefactory-project.io_logservers.yaml b/config/crd/bases/sf.softwarefactory-project.io_logservers.yaml index 0b8f576c..56f9b63a 100644 --- a/config/crd/bases/sf.softwarefactory-project.io_logservers.yaml +++ b/config/crd/bases/sf.softwarefactory-project.io_logservers.yaml @@ -100,9 +100,6 @@ spec: as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object diff --git a/config/crd/bases/sf.softwarefactory-project.io_softwarefactories.yaml b/config/crd/bases/sf.softwarefactory-project.io_softwarefactories.yaml index 0fc38fed..e1ddd2fe 100644 --- a/config/crd/bases/sf.softwarefactory-project.io_softwarefactories.yaml +++ b/config/crd/bases/sf.softwarefactory-project.io_softwarefactories.yaml @@ -95,9 +95,6 @@ spec: as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object @@ -146,9 +143,6 @@ spec: as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object @@ -178,9 +172,6 @@ spec: as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object @@ -201,9 +192,6 @@ spec: as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object @@ -243,9 +231,6 @@ spec: expressed as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object @@ -290,9 +275,6 @@ spec: as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object @@ -339,9 +321,6 @@ spec: expressed as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object @@ -493,9 +472,6 @@ spec: expressed as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object @@ -602,9 +578,6 @@ spec: expressed as a Quantity: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/' pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true - x-kubernetes-validations: - - message: Storage shrinking is not supported - rule: self >= oldSelf required: - size type: object diff --git a/roles/health-check/test-crd/tasks/main.yaml b/roles/health-check/test-crd/tasks/main.yaml index 9d1fafc8..354bad4c 100644 --- a/roles/health-check/test-crd/tasks/main.yaml +++ b/roles/health-check/test-crd/tasks/main.yaml @@ -20,12 +20,6 @@ # The default storage size asked by the SF controller is 1GB failed_when: logserver_capacity.stdout == '1Gi' -- name: Ensure it is impossible to shrink storage size in sf CR - ansible.builtin.command: | - kubectl patch SoftwareFactory my-sf --type=merge -p '{"spec": {"logserver": {"storage": {"size": "1Gi"}}}}' - register: patch_result - failed_when: "('shrinking is not supported' not in patch_result.stderr) and ('shrinking is not supported' not in patch_result.stdout)" - - name: Ensure it is impossible to set a negative loopDelay ansible.builtin.command: | kubectl patch SoftwareFactory my-sf --type=merge -p '{"spec": {"logserver": {"loopDelay": -1}}}'