Skip to content

Commit

Permalink
crd - XValidation - remove as it appears to not fully work
Browse files Browse the repository at this point in the history
Change-Id: If10f4c1cb5cd581ca71b5c1c12251a2a565702ae
  • Loading branch information
morucci committed Oct 19, 2023
1 parent b149b3e commit 3c87d9b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 38 deletions.
2 changes: 0 additions & 2 deletions api/v1/softwarefactory_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions roles/health-check/test-crd/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}}'
Expand Down

0 comments on commit 3c87d9b

Please sign in to comment.