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

Fix use of API Version in reconciler #2419

Merged
merged 5 commits into from
Jul 27, 2022

Conversation

theunrepentantgeek
Copy link
Member

Closes #[issue number]

What this PR does / why we need it:

The API version associated with a resource is the one that should always be used when making ARM REST API calls. This wasn't the case, as documented in #2416

Fixes #2416

Special notes for your reviewer:

Thanks to @matthchr for helping to track down the issue.

How does this PR make you feel:
gif


apiVersion, err := genruntime.GetAPIVersion(metaObject, scheme)
if err != nil {
panic(err)
Copy link
Member

Choose a reason for hiding this comment

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

I think we should avoid panic in the reconciler codepaths as much as we can? I know it makes it more awkward to use but can we return err here instead?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree with @matthchr here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was on the fence; originally wrote it with errors and then changed to use a panic to reduce boilerplate.

Changed it back.

@theunrepentantgeek theunrepentantgeek enabled auto-merge (squash) July 27, 2022 00:02
Copy link
Member

@matthchr matthchr left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for making that err change

@theunrepentantgeek theunrepentantgeek merged commit 7d217c6 into main Jul 27, 2022
@theunrepentantgeek theunrepentantgeek deleted the fix/reconciler-api-versions branch July 27, 2022 00:36
@theunrepentantgeek theunrepentantgeek changed the title Add helper method GetAPIVersion to genruntime Fix use of API Version in reconciler Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

API version should be consistent when interacting with ARM
3 participants