You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
errList=append(errList, field.Required(fldPath.Child("pvc").Child("name"), fmt.Sprintf("must be provided when %s is false", fldPath.Child("pvc").Child("create"))))
144
+
if(pvc.Create==nil||!*pvc.Create)&&pvc.Name=="" {
145
+
errList=append(errList, field.Required(fldPath.Child("name"), fmt.Sprintf("must be provided when %s is false", fldPath.Child("create"))))
141
146
}
142
147
143
148
// If PVC.VolumeAccessMode is defined, it must be one of the valid modes
errList=append(errList, field.Required(fldPath.Child("pvc").Child("name"), fmt.Sprintf("must be provided when %s is false", fldPath.Child("pvc").Child("create"))))
fmt.Sprintf("must not be set when %s > 1 or %s, only %s is allowed", fldPath.Child("replicas"), fldPath.Child("scale").Child("enabled"), draResourcesPath.Index(i).Child("draResourceClaimTemplateName"))))
121
+
fmt.Sprintf("must not be set when %s > 1 or %s, only %s is allowed", fldPath.Child("replicas"), fldPath.Child("scale").Child("enabled"), draResourcesPath.Index(i).Child("resourceClaimTemplateName"))))
137
122
}
138
123
}
139
-
} else {
140
-
141
-
// If DRAResources is not empty, all DRAResources objects must have a unique DRAResource.ResourceClaimName
142
-
draResources:=spec.DRAResources
143
-
iflen(draResources) >0 {
144
-
seen:=make(map[string]struct{})
145
-
fori, dra:=rangedraResources {
146
-
ifdra.ResourceClaimName==nil {
147
-
errList=append(errList, field.Required(draResourcesPath.Index(i).Child("resourceClaimName"), "must not be empty"))
148
-
continue
149
-
}
124
+
}
125
+
// If DRAResources has multiple entries with DRAResource.ResourceClaimName, they have to be unique names. Additionally, only one of DRAResource.ResourceClaimName or DRAResource.ResourceClaimTemplateName must be defined.
126
+
draResources:=spec.DRAResources
127
+
iflen(draResources) >0 {
128
+
seen:=make(map[string]struct{})
129
+
fori, dra:=rangedraResources {
130
+
// Must have only one of the two defined
131
+
if (dra.ResourceClaimName==nil&&dra.ResourceClaimTemplateName==nil) || (dra.ResourceClaimName!=nil&&dra.ResourceClaimTemplateName!=nil) {
132
+
errList=append(errList, field.Invalid(draResourcesPath.Index(i), dra, "must specify exactly one of resourceClaimName or resourceClaimTemplateName"))
0 commit comments