Skip to content

Commit

Permalink
make NodeName immutable
Browse files Browse the repository at this point in the history
Add CEL validation rule to make NodeMaintenance NodeName
immutable.

Signed-off-by: adrianc <[email protected]>
  • Loading branch information
adrianchiris committed Aug 25, 2024
1 parent 506806f commit 777d06f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/v1alpha1/nodemaintenance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,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
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 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 Down

0 comments on commit 777d06f

Please sign in to comment.