Skip to content

Commit

Permalink
Merge pull request k0rdent#356 from eromanova/template-immutable
Browse files Browse the repository at this point in the history
Validate that Templates spec is immutable
  • Loading branch information
Kshatrix authored Sep 20, 2024
2 parents 13b5245 + 05ace0c commit c757bb2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/v1alpha1/clustertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type ClusterTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Spec is immutable"
Spec ClusterTemplateSpec `json:"spec,omitempty"`
Status ClusterTemplateStatus `json:"status,omitempty"`
}
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/providertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type ProviderTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Spec is immutable"
Spec ProviderTemplateSpec `json:"spec,omitempty"`
Status ProviderTemplateStatus `json:"status,omitempty"`
}
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/servicetemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type ServiceTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Spec is immutable"
Spec ServiceTemplateSpec `json:"spec,omitempty"`
Status ServiceTemplateStatus `json:"status,omitempty"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ spec:
required:
- helm
type: object
x-kubernetes-validations:
- message: Spec is immutable
rule: self == oldSelf
status:
description: ClusterTemplateStatus defines the observed state of ClusterTemplate
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ spec:
required:
- helm
type: object
x-kubernetes-validations:
- message: Spec is immutable
rule: self == oldSelf
status:
description: ProviderTemplateStatus defines the observed state of ProviderTemplate
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ spec:
required:
- helm
type: object
x-kubernetes-validations:
- message: Spec is immutable
rule: self == oldSelf
status:
description: ServiceTemplateStatus defines the observed state of ServiceTemplate
properties:
Expand Down

0 comments on commit c757bb2

Please sign in to comment.