diff --git a/api/v1alpha1/lvmcluster_types.go b/api/v1alpha1/lvmcluster_types.go index 1e908a0b3..846dcde28 100644 --- a/api/v1alpha1/lvmcluster_types.go +++ b/api/v1alpha1/lvmcluster_types.go @@ -35,6 +35,11 @@ type LVMClusterSpec struct { type DeviceClass struct { // Name of the class, the VG and possibly the storageclass. + // Validations to confirm that this field can be used as metadata.name field in storageclass + // ref: https://github.com/kubernetes/apimachinery/blob/de7147/pkg/util/validation/validation.go#L209 + // +kubebuilder:validation:MaxLength=245 + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" Name string `json:"name,omitempty"` // DeviceSelector is a set of rules that should match for a device to be included in this TopoLVMCluster diff --git a/config/crd/bases/lvm.topolvm.io_lvmclusters.yaml b/config/crd/bases/lvm.topolvm.io_lvmclusters.yaml index e039c776f..c63e704c1 100644 --- a/config/crd/bases/lvm.topolvm.io_lvmclusters.yaml +++ b/config/crd/bases/lvm.topolvm.io_lvmclusters.yaml @@ -46,7 +46,12 @@ spec: for a device to be included in this TopoLVMCluster type: object name: - description: Name of the class, the VG and possibly the storageclass. + description: 'Name of the class, the VG and possibly the storageclass. + Validations to confirm that this field can be used as metadata.name + field in storageclass ref: https://github.com/kubernetes/apimachinery/blob/de7147/pkg/util/validation/validation.go#L209' + maxLength: 245 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ type: string nodeSelector: description: NodeSelector chooses nodes