mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +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, ValidateLabels(spec.NodeSelector, "nodeSelector")...)
|
||||||
allErrs = append(allErrs, validateHostNetwork(spec.HostNetwork, spec.Containers).Prefix("hostNetwork")...)
|
allErrs = append(allErrs, validateHostNetwork(spec.HostNetwork, spec.Containers).Prefix("hostNetwork")...)
|
||||||
allErrs = append(allErrs, validateImagePullSecrets(spec.ImagePullSecrets).Prefix("imagePullSecrets")...)
|
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 != nil {
|
||||||
if *spec.ActiveDeadlineSeconds <= 0 {
|
if *spec.ActiveDeadlineSeconds <= 0 {
|
||||||
|
@ -1052,7 +1052,6 @@ func TestValidatePodSpec(t *testing.T) {
|
|||||||
NodeName: "foobar",
|
NodeName: "foobar",
|
||||||
DNSPolicy: api.DNSClusterFirst,
|
DNSPolicy: api.DNSClusterFirst,
|
||||||
ActiveDeadlineSeconds: &activeDeadlineSeconds,
|
ActiveDeadlineSeconds: &activeDeadlineSeconds,
|
||||||
ServiceAccount: "acct",
|
|
||||||
},
|
},
|
||||||
{ // Populate HostNetwork.
|
{ // Populate HostNetwork.
|
||||||
Containers: []api.Container{
|
Containers: []api.Container{
|
||||||
@ -1093,12 +1092,6 @@ func TestValidatePodSpec(t *testing.T) {
|
|||||||
RestartPolicy: api.RestartPolicyAlways,
|
RestartPolicy: api.RestartPolicyAlways,
|
||||||
Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}},
|
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": {
|
"bad restart policy": {
|
||||||
RestartPolicy: "UnknowPolicy",
|
RestartPolicy: "UnknowPolicy",
|
||||||
DNSPolicy: api.DNSClusterFirst,
|
DNSPolicy: api.DNSClusterFirst,
|
||||||
|
Loading…
Reference in New Issue
Block a user