Rename HostDir to HostPath in v1beta3
This commit is contained in:
@@ -67,9 +67,9 @@ func validateVolumes(volumes []api.Volume) (util.StringSet, errs.ValidationError
|
||||
func validateSource(source *api.VolumeSource) errs.ValidationErrorList {
|
||||
numVolumes := 0
|
||||
allErrs := errs.ValidationErrorList{}
|
||||
if source.HostDir != nil {
|
||||
if source.HostPath != nil {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateHostDir(source.HostDir).Prefix("hostDirectory")...)
|
||||
allErrs = append(allErrs, validateHostPath(source.HostPath).Prefix("hostPath")...)
|
||||
}
|
||||
if source.EmptyDir != nil {
|
||||
numVolumes++
|
||||
@@ -77,11 +77,11 @@ func validateSource(source *api.VolumeSource) errs.ValidationErrorList {
|
||||
}
|
||||
if source.GitRepo != nil {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateGitRepo(source.GitRepo)...)
|
||||
allErrs = append(allErrs, validateGitRepo(source.GitRepo).Prefix("gitRepo")...)
|
||||
}
|
||||
if source.GCEPersistentDisk != nil {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateGCEPersistentDisk(source.GCEPersistentDisk)...)
|
||||
allErrs = append(allErrs, validateGCEPersistentDisk(source.GCEPersistentDisk).Prefix("persistentDisk")...)
|
||||
}
|
||||
if numVolumes != 1 {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("", source, "exactly 1 volume type is required"))
|
||||
@@ -89,10 +89,10 @@ func validateSource(source *api.VolumeSource) errs.ValidationErrorList {
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func validateHostDir(hostDir *api.HostDir) errs.ValidationErrorList {
|
||||
func validateHostPath(hostDir *api.HostPath) errs.ValidationErrorList {
|
||||
allErrs := errs.ValidationErrorList{}
|
||||
if hostDir.Path == "" {
|
||||
allErrs = append(allErrs, errs.NewNotFound("path", hostDir.Path))
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("path", hostDir.Path))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func validateHostDir(hostDir *api.HostDir) errs.ValidationErrorList {
|
||||
func validateGitRepo(gitRepo *api.GitRepo) errs.ValidationErrorList {
|
||||
allErrs := errs.ValidationErrorList{}
|
||||
if gitRepo.Repository == "" {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("gitRepo.Repository", gitRepo.Repository))
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("repository", gitRepo.Repository))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
@@ -108,13 +108,13 @@ func validateGitRepo(gitRepo *api.GitRepo) errs.ValidationErrorList {
|
||||
func validateGCEPersistentDisk(PD *api.GCEPersistentDisk) errs.ValidationErrorList {
|
||||
allErrs := errs.ValidationErrorList{}
|
||||
if PD.PDName == "" {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("PD.PDName", PD.PDName))
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("pdName", PD.PDName))
|
||||
}
|
||||
if PD.FSType == "" {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("PD.FSType", PD.FSType))
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("fsType", PD.FSType))
|
||||
}
|
||||
if PD.Partition < 0 || PD.Partition > 255 {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("PD.Partition", PD.Partition, ""))
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("partition", PD.Partition, ""))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
Reference in New Issue
Block a user