Skip to content

Commit

Permalink
Make OpenStackDataPlaneDeployment Spec immutable
Browse files Browse the repository at this point in the history
This way one can't change the deployment to add
nodesets when deployment is in progress or update
an already deployed deployment.

Though we can use the rbac roles to not allow
update/patch to it, this kind of ensures that
without the need for some code in the webhook.

Signed-off-by: rabi <[email protected]>
  • Loading branch information
rabi committed Mar 14, 2024
1 parent 085768d commit 2432668
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ spec:
- deploymentRequeueTime
- nodeSets
type: object
x-kubernetes-validations:
- message: OpenStackDataPlaneDeployment Spec is immutable
rule: self == oldSelf
status:
properties:
conditions:
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/openstackdataplanedeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type OpenStackDataPlaneDeployment struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="OpenStackDataPlaneDeployment Spec is immutable"
Spec OpenStackDataPlaneDeploymentSpec `json:"spec,omitempty"`
Status OpenStackDataPlaneDeploymentStatus `json:"status,omitempty"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ spec:
- deploymentRequeueTime
- nodeSets
type: object
x-kubernetes-validations:
- message: OpenStackDataPlaneDeployment Spec is immutable
rule: self == oldSelf
status:
properties:
conditions:
Expand Down

0 comments on commit 2432668

Please sign in to comment.