Skip to content

Commit

Permalink
Drop alpha/beta init containers annotations on conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
liggitt committed Sep 1, 2017
1 parent 8719b4a commit 525254a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
22 changes: 22 additions & 0 deletions pkg/api/v1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,28 @@ func Convert_v1_PodSpec_To_api_PodSpec(in *v1.PodSpec, out *api.PodSpec, s conve
return nil
}

func Convert_api_Pod_To_v1_Pod(in *api.Pod, out *v1.Pod, s conversion.Scope) error {
if err := autoConvert_api_Pod_To_v1_Pod(in, out, s); err != nil {
return err
}

// drop init container annotations so they don't take effect on legacy kubelets.
// remove this once the oldest supported kubelet no longer honors the annotations over the field.
if len(out.Annotations) > 0 {
old := out.Annotations
out.Annotations = make(map[string]string, len(old))
for k, v := range old {
out.Annotations[k] = v
}
delete(out.Annotations, "pod.beta.kubernetes.io/init-containers")
delete(out.Annotations, "pod.alpha.kubernetes.io/init-containers")
delete(out.Annotations, "pod.beta.kubernetes.io/init-container-statuses")
delete(out.Annotations, "pod.alpha.kubernetes.io/init-container-statuses")
}

return nil
}

func Convert_v1_Secret_To_api_Secret(in *v1.Secret, out *api.Secret, s conversion.Scope) error {
if err := autoConvert_v1_Secret_To_api_Secret(in, out, s); err != nil {
return err
Expand Down
5 changes: 0 additions & 5 deletions pkg/api/v1/zz_generated.conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3248,11 +3248,6 @@ func autoConvert_api_Pod_To_v1_Pod(in *api.Pod, out *v1.Pod, s conversion.Scope)
return nil
}

// Convert_api_Pod_To_v1_Pod is an autogenerated conversion function.
func Convert_api_Pod_To_v1_Pod(in *api.Pod, out *v1.Pod, s conversion.Scope) error {
return autoConvert_api_Pod_To_v1_Pod(in, out, s)
}

func autoConvert_v1_PodAffinity_To_api_PodAffinity(in *v1.PodAffinity, out *api.PodAffinity, s conversion.Scope) error {
out.RequiredDuringSchedulingIgnoredDuringExecution = *(*[]api.PodAffinityTerm)(unsafe.Pointer(&in.RequiredDuringSchedulingIgnoredDuringExecution))
out.PreferredDuringSchedulingIgnoredDuringExecution = *(*[]api.WeightedPodAffinityTerm)(unsafe.Pointer(&in.PreferredDuringSchedulingIgnoredDuringExecution))
Expand Down

0 comments on commit 525254a

Please sign in to comment.