mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Merge pull request #10083 from GoogleCloudPlatform/revert-9688-validate_pod_spec
Revert "Validate service account name in pod spec"
This commit is contained in:
commit
b2e9fed349
@ -963,11 +963,6 @@ func ValidatePodSpec(spec *api.PodSpec) errs.ValidationErrorList {
|
||||
allErrs = append(allErrs, ValidateLabels(spec.NodeSelector, "nodeSelector")...)
|
||||
allErrs = append(allErrs, validateHostNetwork(spec.HostNetwork, spec.Containers).Prefix("hostNetwork")...)
|
||||
allErrs = append(allErrs, validateImagePullSecrets(spec.ImagePullSecrets).Prefix("imagePullSecrets")...)
|
||||
if len(spec.ServiceAccount) > 0 {
|
||||
if ok, msg := ValidateServiceAccountName(spec.ServiceAccount, false); !ok {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("serviceAccount", spec.ServiceAccount, msg))
|
||||
}
|
||||
}
|
||||
|
||||
if spec.ActiveDeadlineSeconds != nil {
|
||||
if *spec.ActiveDeadlineSeconds <= 0 {
|
||||
|
@ -1052,7 +1052,6 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
NodeName: "foobar",
|
||||
DNSPolicy: api.DNSClusterFirst,
|
||||
ActiveDeadlineSeconds: &activeDeadlineSeconds,
|
||||
ServiceAccount: "acct",
|
||||
},
|
||||
{ // Populate HostNetwork.
|
||||
Containers: []api.Container{
|
||||
@ -1093,12 +1092,6 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
RestartPolicy: api.RestartPolicyAlways,
|
||||
Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}},
|
||||
},
|
||||
"bad service account name": {
|
||||
Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}},
|
||||
RestartPolicy: api.RestartPolicyAlways,
|
||||
DNSPolicy: api.DNSClusterFirst,
|
||||
ServiceAccount: "invalidName",
|
||||
},
|
||||
"bad restart policy": {
|
||||
RestartPolicy: "UnknowPolicy",
|
||||
DNSPolicy: api.DNSClusterFirst,
|
||||
|
Loading…
Reference in New Issue
Block a user