Skip to content

Commit

Permalink
Merge pull request #15 from adrianchiris/make-requestor-id-immutable
Browse files Browse the repository at this point in the history
make requestorID and nodeName immutable
  • Loading branch information
ykulazhenkov authored Aug 27, 2024
2 parents 8b5f027 + 5a15165 commit 9034e67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/v1alpha1/nodemaintenance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type NodeMaintenanceSpec struct {
// +kubebuilder:validation:Pattern=`^([a-z0-9A-Z]([-a-z0-9A-Z]*[a-z0-9A-Z])?(\.[a-z0-9A-Z]([-a-z0-9A-Z]*[a-z0-9A-Z])?)*)$`
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:MinLength=2
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
RequestorID string `json:"requestorID"`

// AdditionalRequestors is a set of additional requestor IDs which are using the same NodeMaintenance
Expand All @@ -75,6 +76,7 @@ type NodeMaintenanceSpec struct {

// NodeName is The name of the node that maintenance operation will be performed on
// creation fails if node obj does not exist (webhook)
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
NodeName string `json:"nodeName"`

// Cordon if set, marks node as unschedulable during maintenance operation
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/maintenance.nvidia.com_nodemaintenances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ spec:
NodeName is The name of the node that maintenance operation will be performed on
creation fails if node obj does not exist (webhook)
type: string
x-kubernetes-validations:
- message: Value is immutable
rule: self == oldSelf
requestorID:
description: |-
RequestorID MUST follow domain name notation format (https://tools.ietf.org/html/rfc1035#section-2.3.1)
Expand All @@ -127,6 +130,9 @@ spec:
minLength: 2
pattern: ^([a-z0-9A-Z]([-a-z0-9A-Z]*[a-z0-9A-Z])?(\.[a-z0-9A-Z]([-a-z0-9A-Z]*[a-z0-9A-Z])?)*)$
type: string
x-kubernetes-validations:
- message: Value is immutable
rule: self == oldSelf
waitForPodCompletion:
description: |-
WaitForPodCompletion specifies pods via selector to wait for completion before performing drain operation
Expand Down

0 comments on commit 9034e67

Please sign in to comment.