Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce Palmer <[email protected]>
  • Loading branch information
everettraven committed Feb 18, 2025
1 parent c4e0467 commit 1dcee82
Show file tree
Hide file tree
Showing 22 changed files with 68 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tests:
status:
nodeStatuses:
- nodeName: a
targetRevision: 1
targetRevision: 0
- nodeName: b
targetRevision: 0
- nodeName: c
Expand All @@ -50,17 +50,20 @@ tests:
status:
nodeStatuses:
- nodeName: a
currentRevision: 3
currentRevision: 0
updated: |
apiVersion: operator.openshift.io/v1
kind: KubeAPIServer
spec: {} # No spec is required for a KubeAPIServer
status:
nodeStatuses:
- nodeName: a
currentRevision: 2
currentRevision: -1
expectedStatusError: "status.nodeStatuses[0].currentRevision: Invalid value: \"integer\": must only increase"
- name: Should reject clearing currentRevision
initialCRDPatches:
- op: remove
path: /spec/versions/0/schema/openAPIV3Schema/properties/status/properties/nodeStatuses/items/properties/currentRevision/x-kubernetes-validations/1
initial: |
apiVersion: operator.openshift.io/v1
kind: KubeAPIServer
Expand All @@ -77,3 +80,62 @@ tests:
nodeStatuses:
- nodeName: a
expectedStatusError: "status.nodeStatuses[0].currentRevision: Invalid value: \"object\": cannot be unset once set"
- name: Should reject setting new nodeStatus with a non-zero currentRevision
initial: |
apiVersion: operator.openshift.io/v1
kind: KubeAPIServer
spec: {} # No spec is required for a KubeAPIServer
status:
nodeStatuses: []
updated: |
apiVersion: operator.openshift.io/v1
kind: KubeAPIServer
spec: {} # No spec is required for a KubeAPIServer
status:
nodeStatuses:
- nodeName: a
currentRevision: 3
expectedStatusError: "status.nodeStatuses[0].currentRevision: Invalid value: \"integer\": must be set to 0 on creation"
- name: Should reject setting new nodeStatus with a non-zero targetRevision
initial: |
apiVersion: operator.openshift.io/v1
kind: KubeAPIServer
spec: {} # No spec is required for a KubeAPIServer
status:
nodeStatuses: []
updated: |
apiVersion: operator.openshift.io/v1
kind: KubeAPIServer
spec: {} # No spec is required for a KubeAPIServer
status:
nodeStatuses:
- nodeName: a
targetRevision: 3
expectedStatusError: "status.nodeStatuses[0].targetRevision: Invalid value: \"integer\": must be set to 0 on creation"
- name: Should allow adding nodes with name only
initial: |
apiVersion: operator.openshift.io/v1
kind: KubeAPIServer
spec: {} # No spec is required for a KubeAPIServer
status:
nodeStatuses:
- nodeName: a
updated: |
apiVersion: operator.openshift.io/v1
kind: KubeAPIServer
spec: {} # No spec is required for a KubeAPIServer
status:
nodeStatuses:
- nodeName: a
- nodeName: b
expected: |
apiVersion: operator.openshift.io/v1
kind: KubeAPIServer
spec:
logLevel: Normal
operatorLogLevel: Normal
status:
nodeStatuses:
- nodeName: a
- nodeName: b
6 changes: 3 additions & 3 deletions operator/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,13 @@ type NodeStatus struct {
NodeName string `json:"nodeName"`

// currentRevision is the generation of the most recently successful deployment.
// It must be set to 0 on creation. Updates must only increase the value.
// If set on creation, it must be set to 0. Updates must only increase the value.
// +kubebuilder:validation:XValidation:rule="self >= oldSelf",message="must only increase"
// +kubebuilder:validation:XValidation:rule="oldSelf.hasValue() || self == 0",message="must be set to 0 on creation",optionalOldSelf=true
// +required
// +optional
CurrentRevision int32 `json:"currentRevision"`
// targetRevision is the generation of the deployment we're trying to apply.
// It must be set to 0 on creation.
// If set on creation, it must be set to 0.
// +kubebuilder:validation:XValidation:rule="oldSelf.hasValue() || self == 0",message="must be set to 0 on creation",optionalOldSelf=true
// +optional
TargetRevision int32 `json:"targetRevision,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ spec:
optionalOldSelf: true
rule: oldSelf.hasValue() || self == 0
required:
- currentRevision
- nodeName
type: object
x-kubernetes-validations:
Expand Down

0 comments on commit 1dcee82

Please sign in to comment.