Change SecretVolumeSource to use a secret name instead of ObjRef
This commit is contained in:
@@ -331,14 +331,8 @@ func validateGCEPersistentDiskVolumeSource(PD *api.GCEPersistentDiskVolumeSource
|
||||
|
||||
func validateSecretVolumeSource(secretSource *api.SecretVolumeSource) errs.ValidationErrorList {
|
||||
allErrs := errs.ValidationErrorList{}
|
||||
if secretSource.Target.Name == "" {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("target.name"))
|
||||
}
|
||||
if secretSource.Target.Namespace == "" {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("target.namespace"))
|
||||
}
|
||||
if secretSource.Target.Kind != "Secret" {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("target.kind", secretSource.Target.Kind, "Secret"))
|
||||
if secretSource.SecretName == "" {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("secretName"))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
@@ -211,7 +211,7 @@ func TestValidateVolumes(t *testing.T) {
|
||||
{Name: "empty", VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}}},
|
||||
{Name: "gcepd", VolumeSource: api.VolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{"my-PD", "ext4", 1, false}}},
|
||||
{Name: "gitrepo", VolumeSource: api.VolumeSource{GitRepo: &api.GitRepoVolumeSource{"my-repo", "hashstring"}}},
|
||||
{Name: "secret", VolumeSource: api.VolumeSource{Secret: &api.SecretVolumeSource{api.ObjectReference{Namespace: api.NamespaceDefault, Name: "my-secret", Kind: "Secret"}}}},
|
||||
{Name: "secret", VolumeSource: api.VolumeSource{Secret: &api.SecretVolumeSource{"my-secret"}}},
|
||||
}
|
||||
names, errs := validateVolumes(successCase)
|
||||
if len(errs) != 0 {
|
||||
|
Reference in New Issue
Block a user