Rename pod.spec.serviceAccount -> pod.spec.serviceAccountName for v1
This commit is contained in:
@@ -1377,7 +1377,7 @@ func deepCopy_api_PodSpec(in PodSpec, out *PodSpec, c *conversion.Cloner) error
|
||||
} else {
|
||||
out.NodeSelector = nil
|
||||
}
|
||||
out.ServiceAccount = in.ServiceAccount
|
||||
out.ServiceAccountName = in.ServiceAccountName
|
||||
out.NodeName = in.NodeName
|
||||
out.HostNetwork = in.HostNetwork
|
||||
if in.ImagePullSecrets != nil {
|
||||
|
@@ -882,9 +882,9 @@ type PodSpec struct {
|
||||
// NodeSelector is a selector which must be true for the pod to fit on a node
|
||||
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
|
||||
|
||||
// ServiceAccount is the name of the ServiceAccount to use to run this pod
|
||||
// ServiceAccountName is the name of the ServiceAccount to use to run this pod
|
||||
// The pod will be allowed to use secrets referenced by the ServiceAccount
|
||||
ServiceAccount string `json:"serviceAccount"`
|
||||
ServiceAccountName string `json:"serviceAccountName"`
|
||||
|
||||
// NodeName is a request to schedule this pod onto a specific node. If it is non-empty,
|
||||
// the scheduler simply schedules this pod onto that node, assuming that it fits resource
|
||||
|
@@ -1516,7 +1516,7 @@ func convert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conversi
|
||||
} else {
|
||||
out.NodeSelector = nil
|
||||
}
|
||||
out.ServiceAccount = in.ServiceAccount
|
||||
out.ServiceAccountName = in.ServiceAccountName
|
||||
out.NodeName = in.NodeName
|
||||
out.HostNetwork = in.HostNetwork
|
||||
if in.ImagePullSecrets != nil {
|
||||
@@ -3824,7 +3824,7 @@ func convert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conversi
|
||||
} else {
|
||||
out.NodeSelector = nil
|
||||
}
|
||||
out.ServiceAccount = in.ServiceAccount
|
||||
out.ServiceAccountName = in.ServiceAccountName
|
||||
out.NodeName = in.NodeName
|
||||
out.HostNetwork = in.HostNetwork
|
||||
if in.ImagePullSecrets != nil {
|
||||
|
@@ -1308,7 +1308,7 @@ func deepCopy_v1_PodSpec(in PodSpec, out *PodSpec, c *conversion.Cloner) error {
|
||||
} else {
|
||||
out.NodeSelector = nil
|
||||
}
|
||||
out.ServiceAccount = in.ServiceAccount
|
||||
out.ServiceAccountName = in.ServiceAccountName
|
||||
out.NodeName = in.NodeName
|
||||
out.HostNetwork = in.HostNetwork
|
||||
if in.ImagePullSecrets != nil {
|
||||
|
@@ -885,8 +885,8 @@ type PodSpec struct {
|
||||
// NodeSelector is a selector which must be true for the pod to fit on a node
|
||||
NodeSelector map[string]string `json:"nodeSelector,omitempty" description:"selector which must match a node's labels for the pod to be scheduled on that node"`
|
||||
|
||||
// ServiceAccount is the name of the ServiceAccount to use to run this pod
|
||||
ServiceAccount string `json:"serviceAccount,omitempty" description:"name of the ServiceAccount to use to run this pod"`
|
||||
// ServiceAccountName is the name of the ServiceAccount to use to run this pod
|
||||
ServiceAccountName string `json:"serviceAccountName,omitempty" description:"name of the ServiceAccount to use to run this pod"`
|
||||
|
||||
// NodeName is a request to schedule this pod onto a specific node. If it is non-empty,
|
||||
// the scheduler simply schedules this pod onto that node, assuming that it fits resource
|
||||
|
@@ -490,7 +490,7 @@ func convert_v1beta3_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s con
|
||||
} else {
|
||||
out.NodeSelector = nil
|
||||
}
|
||||
out.ServiceAccount = in.ServiceAccount
|
||||
out.ServiceAccountName = in.ServiceAccount
|
||||
out.NodeName = in.Host
|
||||
out.HostNetwork = in.HostNetwork
|
||||
if in.ImagePullSecrets != nil {
|
||||
@@ -552,7 +552,7 @@ func convert_api_PodSpec_To_v1beta3_PodSpec(in *api.PodSpec, out *PodSpec, s con
|
||||
} else {
|
||||
out.NodeSelector = nil
|
||||
}
|
||||
out.ServiceAccount = in.ServiceAccount
|
||||
out.ServiceAccount = in.ServiceAccountName
|
||||
out.Host = in.NodeName
|
||||
out.HostNetwork = in.HostNetwork
|
||||
if in.ImagePullSecrets != nil {
|
||||
|
@@ -963,9 +963,9 @@ 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 len(spec.ServiceAccountName) > 0 {
|
||||
if ok, msg := ValidateServiceAccountName(spec.ServiceAccountName, false); !ok {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("serviceAccountName", spec.ServiceAccountName, msg))
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1052,7 +1052,7 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
NodeName: "foobar",
|
||||
DNSPolicy: api.DNSClusterFirst,
|
||||
ActiveDeadlineSeconds: &activeDeadlineSeconds,
|
||||
ServiceAccount: "acct",
|
||||
ServiceAccountName: "acct",
|
||||
},
|
||||
{ // Populate HostNetwork.
|
||||
Containers: []api.Container{
|
||||
@@ -1094,10 +1094,10 @@ func TestValidatePodSpec(t *testing.T) {
|
||||
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",
|
||||
Containers: []api.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent"}},
|
||||
RestartPolicy: api.RestartPolicyAlways,
|
||||
DNSPolicy: api.DNSClusterFirst,
|
||||
ServiceAccountName: "invalidName",
|
||||
},
|
||||
"bad restart policy": {
|
||||
RestartPolicy: "UnknowPolicy",
|
||||
|
Reference in New Issue
Block a user