runtime icon indicating copy to clipboard operation
runtime copied to clipboard

feat: Adopt-or-Create

Open michaelhtm opened this issue 8 months ago • 5 comments

Issue #2406

Description of changes: Allow users to create the resource if adoption fails due to a NotFound error. With these changes, we are expecting users to populate all the necessary fields for creation in the resource spec, and the status fields in the adoption-fields annotation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

michaelhtm avatar Apr 04 '25 22:04 michaelhtm

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: michaelhtm Once this PR has been reviewed and has the lgtm label, please assign a-hilaly for approval by writing /assign @a-hilaly in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

ack-prow[bot] avatar Apr 04 '25 22:04 ack-prow[bot]

Hi @michaelhtm! Quick question -- will this overwrite the entire Kubernetes manifest if it's able to adopt an existing resource? From the code I'm seeing, it seems like that's the case.

In my case, I would like to avoid that if possible. Overwriting the manifest from the adopted resource means I have to hit "sync" again for my argo app. Really, I just want to upsert my resource to match my ACK spec.

While I think overwriting the whole thing does seem like a valid use case, maybe it's possible to support both cases? Might be looking at a separate adoption policy of "upsert" or something like that?

gfaraj avatar Apr 07 '25 16:04 gfaraj

@gfaraj Hello, The entire manifest would be replaced with the spec defined in AWS if the adoption-policy is adopt. With the current implementation, if it's adopt-or-create, the controller will do an update after the adoption, if not it will create the resource. Maybe we need a better name than adopt-or-create..

michaelhtm avatar Apr 07 '25 16:04 michaelhtm

@michaelhtm oh nice, thanks for confirming that, I may have misread part of the changes. Yeah then this seems more like an "upsert" -- maybe that should be the policy name instead?

gfaraj avatar Apr 07 '25 16:04 gfaraj

/test sagemaker-controller-test

michaelhtm avatar Apr 21 '25 21:04 michaelhtm

/test sagemaker-controller-test

michaelhtm avatar Apr 25 '25 18:04 michaelhtm

@michaelhtm: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
verify-attribution 6f7e297bc3825f197a0fa129b260fb9ec7860f26 link false /test verify-attribution
sagemaker-controller-test 6f7e297bc3825f197a0fa129b260fb9ec7860f26 link true /test sagemaker-controller-test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

ack-prow[bot] avatar Apr 25 '25 18:04 ack-prow[bot]