Remove unnecessary custom conversion functions#77346
Remove unnecessary custom conversion functions#77346k8s-ci-robot merged 2 commits intokubernetes:masterfrom
Conversation
| return nil | ||
| } | ||
|
|
||
| func Convert_core_SecurityContext_To_v1_SecurityContext(in *core.SecurityContext, out *v1.SecurityContext, s conversion.Scope) error { |
There was a problem hiding this comment.
compare with autogenerated function:
kubernetes/pkg/apis/core/v1/zz_generated.conversion.go
Lines 6816 to 6827 in c3e8a43
(the Convert_... functions being called were the autogenerated ones)
| return nil | ||
| } | ||
|
|
||
| func Convert_core_PodSecurityContext_To_v1_PodSecurityContext(in *core.PodSecurityContext, out *v1.PodSecurityContext, s conversion.Scope) error { |
There was a problem hiding this comment.
compare with autogenerated function:
kubernetes/pkg/apis/core/v1/zz_generated.conversion.go
Lines 5524 to 5537 in c3e8a43
(the Convert_... functions being called were the autogenerated ones)
| return nil | ||
| } | ||
|
|
||
| func Convert_v1_PodSecurityContext_To_core_PodSecurityContext(in *v1.PodSecurityContext, out *core.PodSecurityContext, s conversion.Scope) error { |
There was a problem hiding this comment.
compare with autogenerated function:
kubernetes/pkg/apis/core/v1/zz_generated.conversion.go
Lines 5513 to 5522 in c3e8a43
(the Convert_... functions being called were the autogenerated ones)
| } else { | ||
| out.SecurityContext = nil | ||
| } | ||
| out.SecurityContext = (*core.SecurityContext)(unsafe.Pointer(in.SecurityContext)) |
There was a problem hiding this comment.
not defining a custom function means this can collapse to a direct memory copy
| } else { | ||
| out.SecurityContext = nil | ||
| } | ||
| out.SecurityContext = (*v1.SecurityContext)(unsafe.Pointer(in.SecurityContext)) |
There was a problem hiding this comment.
ditto on direct memory copy
|
/priority backlog |
|
/retest |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, smarterclayton The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/kind cleanup
What this PR does / why we need it:
Several custom conversion functions around pod and container security context structs were not required.
Dropping this streamlines addition of new fields to these structs, since the auto-generated conversion will automatically add copies for the new fields, instead of having to manually update the custom functions
Resolves unit test failures in #77147
Does this PR introduce a user-facing change?:
/sig api-machinery
/cc @sttts