diff --git a/api/v1alpha1/storageclassclaim_types.go b/api/v1alpha1/storageclassclaim_types.go index 2563aa7a5..906af7dbb 100644 --- a/api/v1alpha1/storageclassclaim_types.go +++ b/api/v1alpha1/storageclassclaim_types.go @@ -73,7 +73,9 @@ type StorageClassClaim struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec StorageClassClaimSpec `json:"spec,omitempty"` + // +kubebuilder:validation:Required + // +kubebuilder:validation:XValidation:rule="oldSelf == self",message="spec is immutable" + Spec StorageClassClaimSpec `json:"spec"` Status StorageClassClaimStatus `json:"status,omitempty"` } diff --git a/config/crd/bases/ocs.openshift.io_storageclassclaims.yaml b/config/crd/bases/ocs.openshift.io_storageclassclaims.yaml index c3199f5a7..ae1360ccd 100644 --- a/config/crd/bases/ocs.openshift.io_storageclassclaims.yaml +++ b/config/crd/bases/ocs.openshift.io_storageclassclaims.yaml @@ -74,6 +74,9 @@ spec: - storageClient - type type: object + x-kubernetes-validations: + - message: spec is immutable + rule: oldSelf == self status: description: StorageClassClaimStatus defines the observed state of StorageClassClaim properties: @@ -84,6 +87,8 @@ spec: type: string type: array type: object + required: + - spec type: object served: true storage: true