Skip to content

shortcuts for Api::apply and Api::apply_status #649

@clux

Description

@clux

Saw that these were added by client-go and did some investigation so thought i'd add an issue here for it to at least discuss them.

What is it: see client-go interface for (say) Node:
https://github.com/kubernetes/client-go/blob/f6ce18ae578c8cca64d14ab9687824d9e1305a67/kubernetes/typed/core/v1/node.go#L53-L54

the implementation is just a dumb shortcut to calling the patch method, just coerces the patch into the type you asked for:
https://github.com/kubernetes/client-go/blob/f6ce18ae578c8cca64d14ab9687824d9e1305a67/kubernetes/typed/core/v1/node.go#L191-L243

Their ApplyOptions are simple:
https://github.com/kubernetes/apimachinery/blob/71bf7ba06cd490392e05cd6828ae24a69cb0ccaa/pkg/apis/meta/v1/generated.proto#L141-L160
basically the same as their PatchOptions..

the weirdest thing is they got alternate variants of their structs for apply builders(?). comparing the two:

they seem identical, so it must just be for the builders in applyconfigurations directory?

The shortcut does not deal with the awkward duplicate required metadata: { name: same_value_as_param } being part of the patch, and it technically allows mismatching patch types to the patch at the api level, so it doesn't provide any extra type safety for us i think? at least as long as patch options and apply options remain the same on the kubernetes side.

not sure how valuable this would be to us, but raising this here anyway so that can look back at an analysis, even if the result is a wontfix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiApi abstraction relatedapplypatch or server-side applyblockedawaiting upstream workquestionDirection unclear; possibly a bug, possibly could be improved.

    Type

    No type

    Projects

    Status

    Defining

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions