File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -23,16 +23,26 @@ const (
2323)
2424
2525type VirtualMachineImageCacheLocationSpec struct {
26+
27+ // +required
28+ // +kubebuilder:validation:MinLength=1
29+
2630 // DatacenterID describes the ID of the datacenter to which the image should
2731 // be cached.
2832 DatacenterID string `json:"datacenterID"`
2933
34+ // +required
35+ // +kubebuilder:validation:MinLength=1
36+
3037 // ProfileID describes the ID of the storage profile used to cache the
3138 // image.
3239 // Please note, this profile *must* include the datastore specified by the
3340 // datastoreID field.
3441 ProfileID string `json:"profileID"`
3542
43+ // +required
44+ // +kubebuilder:validation:MinLength=1
45+
3646 // DatastoreID describes the ID of the datastore to which the image should
3747 // be cached.
3848 DatastoreID string `json:"datastoreID"`
Original file line number Diff line number Diff line change @@ -664,18 +664,21 @@ spec:
664664 description : |-
665665 DatacenterID describes the ID of the datacenter to which the image should
666666 be cached.
667+ minLength : 1
667668 type : string
668669 datastoreID :
669670 description : |-
670671 DatastoreID describes the ID of the datastore to which the image should
671672 be cached.
673+ minLength : 1
672674 type : string
673675 profileID :
674676 description : |-
675677 ProfileID describes the ID of the storage profile used to cache the
676678 image.
677679 Please note, this profile *must* include the datastore specified by the
678680 datastoreID field.
681+ minLength : 1
679682 type : string
680683 required :
681684 - datacenterID
Original file line number Diff line number Diff line change @@ -146,8 +146,8 @@ func (e ErrMissingParameter) Error() string {
146146// GetStoragePolicyID returns the storage policy ID for a given StorageClass.
147147// If no ID is found, an error is returned.
148148func GetStoragePolicyID (obj storagev1.StorageClass ) (string , error ) {
149- policyID , ok := obj .Parameters [internal .StoragePolicyIDParameter ]
150- if ! ok {
149+ policyID := obj .Parameters [internal .StoragePolicyIDParameter ]
150+ if policyID == "" {
151151 return "" , ErrMissingParameter {
152152 StorageClassName : obj .Name ,
153153 ParameterName : internal .StoragePolicyIDParameter ,
You can’t perform that action at this time.
0 commit comments