-
Notifications
You must be signed in to change notification settings - Fork 1.2k
⚠️ Add subresource apply support #3321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 6e1e8b2.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
} | ||
|
||
func (sw *fakeSubResourceClient) Apply(ctx context.Context, obj runtime.ApplyConfiguration, opts ...client.SubResourceApplyOption) error { | ||
if sw.subResource != "status" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is different from Patch
, including when using apply through patch which will just patch the main object rather than a subresource when used with subresources other than status.
IMHO it is better to error out rather than to silenly do the wrong thing. We could fo a follow-up to do the same in Patch for consistency (and/or implement the subresources we support through Update
there as well)
} | ||
|
||
// ApplyOpts applies the given options. | ||
func (ao *SubResourceApplyOptions) ApplyOpts(opts []SubResourceApplyOption) *SubResourceApplyOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This differs from our typical naming convention of naming these ApplyOptions
because that name is already used for the embedded field. I chose to embedd the field, because there is prior art of doing that in the SubResourcePatchOptions
and it seems ergonomical to do it that way, because modifying options doesn't requier to know whether they are defined in ApplyOptions
or SubResourceApplyOptions
.
This change adds subresource apply support to the client. It is breaking, as that entails extending the interface.
The fake client currently only supports the
status
subresource for apply and will error out if it is used for any other subresource.Ref #3183
/hold