mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Set defaults for initContainer beta.
This commit is contained in:
@@ -481,10 +481,16 @@ func Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in *PodTemplateSpec, out
|
||||
in.Spec.InitContainers = values
|
||||
|
||||
// Call defaulters explicitly until annotations are removed
|
||||
for i := range in.Spec.InitContainers {
|
||||
c := &in.Spec.InitContainers[i]
|
||||
SetDefaults_Container(c)
|
||||
tmpPodTemp := &PodTemplate{
|
||||
Template: PodTemplateSpec{
|
||||
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 {
|
||||
@@ -604,10 +610,14 @@ func Convert_v1_Pod_To_api_Pod(in *Pod, out *api.Pod, s conversion.Scope) error
|
||||
// back to the caller.
|
||||
in.Spec.InitContainers = values
|
||||
// Call defaulters explicitly until annotations are removed
|
||||
for i := range in.Spec.InitContainers {
|
||||
c := &in.Spec.InitContainers[i]
|
||||
SetDefaults_Container(c)
|
||||
tmpPod := &Pod{
|
||||
Spec: PodSpec{
|
||||
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.
|
||||
// See commit log for PR #31026 for why we do this.
|
||||
|
||||
Reference in New Issue
Block a user