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

Required import to avoid no auth provider available #26

Closed
wants to merge 1 commit into from

Conversation

salaboy
Copy link
Contributor

@salaboy salaboy commented Mar 18, 2021

When trying to run the template project with make run, you hit this issue

ERROR   controller-runtime.manager      Failed to get API Group-Resources       {"error": "no Auth Provider found for name \"gcp\""}

Related: hashicorp/terraform-provider-kubernetes-alpha#46

This import fixes the problem:

_ "k8s.io/client-go/plugin/pkg/client/auth"

Which makes kind of sense..

```
ERROR   controller-runtime.manager      Failed to get API Group-Resources       {"error": "no Auth Provider found for name \"gcp\""}
```

Signed-off-by: salaboy <[email protected]>
Copy link
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

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

Also found this related upstream client-go issue: kubernetes/client-go#839

I'm not sure why we don't see this in core crossplane itself, I don't see it importing this same package in the main crossplane entry point: https://github.com/crossplane/crossplane/blob/master/cmd/crossplane/main.go

Or in providers like provider-aws: https://github.com/crossplane/provider-aws/blob/master/cmd/provider/main.go

Anyone have insight into why it's not needed there?

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.

@jbw976 @salaboy this same behavior could happen with Crossplane or any of the providers, but it only happens when running out of cluster and requiring "auth helpers" from a given cloud provider. For instance, if I have a GKE cluster that gives me a kubeconfig that specified to use gcloud to authenticate, we will not behave properly. This is typically not the setting that Crossplane or the providers are run in, but it can be helpful for developing locally against a remote cluster. I am fairly indifferent to whether we add it here by default or not.

@jbw976
Copy link
Member

jbw976 commented Mar 23, 2021

Ah, thanks for that clarification @hasheddan, that helps me understand this scenario further. I agree that a typical provider wouldn't be executed in this type of setup, where it is running outside of its control plane that is hosted in a cloud provider.

In this template repo, I'd lean towards optimizing for the common scenario, given this comment, this comment and this PR, meaning I don't think this import is needed by default.

I don't think they're useful for most clients, and it has a pretty big dependency footprint.

What are your thoughts on including this @salaboy? Happy to hear your opinion too :)

@salaboy
Copy link
Contributor Author

salaboy commented Mar 23, 2021

@jbw976 I think it makes a lot of sense to not include it in the code itself, as that is not needed there for the provider final version running inside a cluster. But it should be mentioned in the https://github.com/crossplane/provider-template/blob/master/README.md inside the Developing section.
A note saying that you need to add _ "k8s.io/client-go/plugin/pkg/client/auth" import and in which file is that recommend.. probably also mentioned that the import needs to be removed for production usage.

@negz
Copy link
Member

negz commented May 29, 2024

Closing some very old PRs. :)

@negz negz closed this May 29, 2024
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.

4 participants