Skip to content

Commit

Permalink
fixup! better message
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce Palmer <[email protected]>
  • Loading branch information
everettraven committed Feb 19, 2025
1 parent 1547ebd commit 1b31db9
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ tests:
nodeStatuses:
- nodeName: a
currentRevision: 3
expectedStatusError: "status.nodeStatuses[0]: Invalid value: \"object\": when specified on creation of a nodeStatus, currentRevision must be set to 0 on creation"
expectedStatusError: "status.nodeStatuses[0]: Invalid value: \"object\": when specified on creation of a nodeStatus, currentRevision must be set to 0"
- name: Should reject setting new nodeStatus with a non-zero targetRevision
initial: |
apiVersion: operator.openshift.io/v1
Expand All @@ -111,7 +111,7 @@ tests:
nodeStatuses:
- nodeName: a
targetRevision: 3
expectedStatusError: "status.nodeStatuses[0]: Invalid value: \"object\": when specified on creation of a nodeStatus, targetRevision must be set to 0 on creation"
expectedStatusError: "status.nodeStatuses[0]: Invalid value: \"object\": when specified on creation of a nodeStatus, targetRevision must be set to 0"
- name: Should allow adding nodes with name only
initial: |
apiVersion: operator.openshift.io/v1
Expand Down
4 changes: 2 additions & 2 deletions operator/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ type StaticPodOperatorStatus struct {

// NodeStatus provides information about the current state of a particular node managed by this operator.
// +kubebuilder:validation:XValidation:rule="has(self.currentRevision) || !has(oldSelf.currentRevision)",message="cannot be unset once set",fieldPath=".currentRevision"
// +kubebuilder:validation:XValidation:rule="oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision == 0 : true) ",message="when specified on creation of a nodeStatus, currentRevision must be set to 0 on creation",optionalOldSelf=true
// +kubebuilder:validation:XValidation:rule="oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision == 0 : true) ",message="when specified on creation of a nodeStatus, targetRevision must be set to 0 on creation",optionalOldSelf=true
// +kubebuilder:validation:XValidation:rule="oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision == 0 : true) ",message="when specified on creation of a nodeStatus, currentRevision must be set to 0",optionalOldSelf=true
// +kubebuilder:validation:XValidation:rule="oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision == 0 : true) ",message="when specified on creation of a nodeStatus, targetRevision must be set to 0",optionalOldSelf=true
type NodeStatus struct {
// nodeName is the name of the node
// +required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
4 changes: 2 additions & 2 deletions payload-manifests/crds/0000_12_etcd_01_etcds-Default.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ spec:
message: cannot be unset once set
rule: has(self.currentRevision) || !has(oldSelf.currentRevision)
- message: when specified on creation of a nodeStatus, currentRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.currentRevision) ? self.currentRevision
== 0 : true) '
- message: when specified on creation of a nodeStatus, targetRevision
must be set to 0 on creation
must be set to 0
optionalOldSelf: true
rule: 'oldSelf.hasValue() || (has(self.targetRevision) ? self.targetRevision
== 0 : true) '
Expand Down

0 comments on commit 1b31db9

Please sign in to comment.