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

Default ProviderConfig is automatically selected #202

Merged
merged 1 commit into from
Sep 23, 2020

Conversation

muvaf
Copy link
Member

@muvaf muvaf commented Sep 21, 2020

Description of your changes

If spec.providerConfigRef is empty, it will be filled with default.

Note that this PR adds that new initializer to the default initializer list but there are managed resources who supply their own initializers. So, we'll need to update them manually.

Fixes crossplane/crossplane#1686

Checklist

I have:

  • Run make reviewable to ensure this PR is ready for review.
  • Ensured this PR contains a neat, self documenting set of commits.
  • Updated any relevant documentation, examples, or release notes.
  • Updated the RBAC permissions in clusterrole.yaml to include any new types.

…derConfig reference use the default one

Signed-off-by: Muvaffak Onus <onus.muvaffak@gmail.com>
@muvaf muvaf requested review from kasey and negz September 21, 2020 18:01
Copy link
Member

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

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

Note that this PR adds that new initializer to the default initializer list but there are managed resources who supply their own initializers. So, we'll need to update them manually.

Would it make since for this just to be in the managed reconciler body? Do you think there will be cases where we don't want this behavior?

Alternatively, we could have some sort of defaulter interface to separate this from NewNameAsExternalName() which feels like something which may be overridden more frequently. Not strictly opposed to what you have here, but just wanted to float a few more ideas :)

@muvaf
Copy link
Member Author

muvaf commented Sep 22, 2020

Alternatively, we could have some sort of defaulter interface to separate this from NewNameAsExternalName() which feels like something which may be overridden more frequently.

Actually, the reason we had introduced the Initializer interface was defaulting. I agree that most probably, it will not be overridden in conventional infra providers. However, it's still a defaulting mechanism so it fits into why we have Initializer in the first place. So, the ability to override is kind of a positive side-effect in this case for users who develop unconventional or internal providers (maybe wish to use a mechanism to create a ProviderConfig that uses ec2 metadata by default rather than assuming one exists) but not my main goal here.

Not strictly opposed to what you have here, but just wanted to float a few more ideas :)

Keep them coming, it's always helpful for me to reconsider my thought process :)

@negz
Copy link
Member

negz commented Sep 22, 2020

Would it make since for this just to be in the managed reconciler body?

I'd like us to have a pretty high bar for adding more logic to the managed reconciler body given how complex it is already.

Copy link
Member

@negz negz left a comment

Choose a reason for hiding this comment

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

This approach didn't occur to me, but it seems like a good one. I presume we'll also need to update any controllers we still have lying around that don't use the managed resource reconciler?

@muvaf
Copy link
Member Author

muvaf commented Sep 23, 2020

I presume we'll also need to update any controllers we still have lying around that don't use the managed resource reconciler?

Yes, that looks like the case :/

@muvaf muvaf merged commit e1fc049 into crossplane:master Sep 23, 2020
@muvaf muvaf deleted the providebydefault branch September 23, 2020 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Managed resources should support default provider configurations
3 participants