Skip to content
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

Add existence checking to adoption handler #11

Merged
merged 1 commit into from
Sep 9, 2022
Merged

Conversation

ecordell
Copy link
Contributor

@ecordell ecordell commented Sep 9, 2022

If a non-existent object is "adopted", the server-side-apply to label/annotate the object will end up creating an empty object.

This change adds an optional existence check to the adoption handler that can be used to abort the adoption process early if the object doesn't exist.

@ecordell ecordell requested a review from jzelinskie September 9, 2022 18:03
Copy link
Member

@jakedt jakedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is it optional?

@jzelinskie
Copy link
Member

How is it optional?

I guess if the controller just did something else with the resource, it can assume it's there. There are definitely race conditions to account for though

@ecordell
Copy link
Contributor Author

ecordell commented Sep 9, 2022

You can just return true in the existence check and the handler will keep going as if it were there.

@jakedt
Copy link
Member

jakedt commented Sep 9, 2022

Optional to me means that if you pass a nil for that function it will use a default handler that does that. It's ok if it's only "optional" though.

@ecordell ecordell force-pushed the existence-check-adopt branch from 2a869b9 to 7d60ace Compare September 9, 2022 18:52
@ecordell ecordell requested a review from jakedt September 9, 2022 18:52
@ecordell ecordell force-pushed the existence-check-adopt branch from 7d60ace to 4a7902a Compare September 9, 2022 18:54
@ecordell ecordell enabled auto-merge September 9, 2022 18:55
@ecordell ecordell disabled auto-merge September 9, 2022 18:55
@ecordell ecordell enabled auto-merge September 9, 2022 18:56
@ecordell ecordell merged commit 37daaef into main Sep 9, 2022
@ecordell ecordell deleted the existence-check-adopt branch September 9, 2022 18:56
@github-actions github-actions bot locked and limited conversation to collaborators Sep 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants