mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
Merge pull request #51092 from humblec/gluster-validation
Automatic merge from submit-queue (batch tested with PRs 51047, 48573, 50764, 51092, 50578) Replace validateGlusterfs() with validateGlusterfsVolumeSource() for consistency.
This commit is contained in:
commit
55c601b5d8
@ -458,7 +458,7 @@ func validateVolumeSource(source *api.VolumeSource, fldPath *field.Path, volName
|
|||||||
allErrs = append(allErrs, field.Forbidden(fldPath.Child("glusterfs"), "may not specify more than 1 volume type"))
|
allErrs = append(allErrs, field.Forbidden(fldPath.Child("glusterfs"), "may not specify more than 1 volume type"))
|
||||||
} else {
|
} else {
|
||||||
numVolumes++
|
numVolumes++
|
||||||
allErrs = append(allErrs, validateGlusterfs(source.Glusterfs, fldPath.Child("glusterfs"))...)
|
allErrs = append(allErrs, validateGlusterfsVolumeSource(source.Glusterfs, fldPath.Child("glusterfs"))...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if source.Flocker != nil {
|
if source.Flocker != nil {
|
||||||
@ -815,7 +815,7 @@ func validateQuobyteVolumeSource(quobyte *api.QuobyteVolumeSource, fldPath *fiel
|
|||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateGlusterfs(glusterfs *api.GlusterfsVolumeSource, fldPath *field.Path) field.ErrorList {
|
func validateGlusterfsVolumeSource(glusterfs *api.GlusterfsVolumeSource, fldPath *field.Path) field.ErrorList {
|
||||||
allErrs := field.ErrorList{}
|
allErrs := field.ErrorList{}
|
||||||
if len(glusterfs.EndpointsName) == 0 {
|
if len(glusterfs.EndpointsName) == 0 {
|
||||||
allErrs = append(allErrs, field.Required(fldPath.Child("endpoints"), ""))
|
allErrs = append(allErrs, field.Required(fldPath.Child("endpoints"), ""))
|
||||||
@ -1273,7 +1273,7 @@ func ValidatePersistentVolume(pv *api.PersistentVolume) field.ErrorList {
|
|||||||
allErrs = append(allErrs, field.Forbidden(specPath.Child("glusterfs"), "may not specify more than 1 volume type"))
|
allErrs = append(allErrs, field.Forbidden(specPath.Child("glusterfs"), "may not specify more than 1 volume type"))
|
||||||
} else {
|
} else {
|
||||||
numVolumes++
|
numVolumes++
|
||||||
allErrs = append(allErrs, validateGlusterfs(pv.Spec.Glusterfs, specPath.Child("glusterfs"))...)
|
allErrs = append(allErrs, validateGlusterfsVolumeSource(pv.Spec.Glusterfs, specPath.Child("glusterfs"))...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if pv.Spec.Flocker != nil {
|
if pv.Spec.Flocker != nil {
|
||||||
|
@ -998,7 +998,7 @@ func TestValidateGlusterfs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, tc := range testCases {
|
for i, tc := range testCases {
|
||||||
errs := validateGlusterfs(tc.gfs, field.NewPath("field"))
|
errs := validateGlusterfsVolumeSource(tc.gfs, field.NewPath("field"))
|
||||||
|
|
||||||
if len(errs) > 0 && tc.errtype == "" {
|
if len(errs) > 0 && tc.errtype == "" {
|
||||||
t.Errorf("[%d: %q] unexpected error(s): %v", i, tc.name, errs)
|
t.Errorf("[%d: %q] unexpected error(s): %v", i, tc.name, errs)
|
||||||
|
Loading…
Reference in New Issue
Block a user