Skip to content

Commit

Permalink
Merge pull request #47 from leelavg/sc-name
Browse files Browse the repository at this point in the history
fix: validate deviceClass name to be usable in storageClass
  • Loading branch information
nbalacha authored Dec 27, 2021
2 parents 18b9cc3 + 037985a commit 5680a87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/v1alpha1/lvmcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion config/crd/bases/lvm.topolvm.io_lvmclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5680a87

Please sign in to comment.