Set defaults for initContainer beta.

Kubernetes-commit: 7b7a759915c515c37455dafa2e98b4d95e6ce6b7
This commit is contained in:
Klaus Ma 2017-03-01 12:57:01 +08:00 committed by Kubernetes Publisher
parent 1f311d1b79
commit ca719949f1

View File

@ -481,10 +481,16 @@ func Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *PodTemplateSpec, out
in.Spec.InitContainers = values in.Spec.InitContainers = values
// Call defaulters explicitly until annotations are removed // Call defaulters explicitly until annotations are removed
for i := range in.Spec.InitContainers { tmpPodTemp := &PodTemplate{
c := &in.Spec.InitContainers[i] Template: PodTemplateSpec{
SetDefaults_Container(c) Spec: PodSpec{
HostNetwork: in.Spec.HostNetwork,
InitContainers: values,
},
},
} }
SetObjectDefaults_PodTemplate(tmpPodTemp)
in.Spec.InitContainers = tmpPodTemp.Template.Spec.InitContainers
} }
if err := autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in, out, s); err != nil { if err := autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in, out, s); err != nil {
@ -604,10 +610,14 @@ func Convert_v1_Pod_To_api_Pod(in *Pod, out *api.Pod, s conversion.Scope) error
// back to the caller. // back to the caller.
in.Spec.InitContainers = values in.Spec.InitContainers = values
// Call defaulters explicitly until annotations are removed // Call defaulters explicitly until annotations are removed
for i := range in.Spec.InitContainers { tmpPod := &Pod{
c := &in.Spec.InitContainers[i] Spec: PodSpec{
SetDefaults_Container(c) HostNetwork: in.Spec.HostNetwork,
InitContainers: values,
},
} }
SetObjectDefaults_Pod(tmpPod)
in.Spec.InitContainers = tmpPod.Spec.InitContainers
} }
// If there is a beta annotation, copy to alpha key. // If there is a beta annotation, copy to alpha key.
// See commit log for PR #31026 for why we do this. // See commit log for PR #31026 for why we do this.