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

Feature request: Automatically attempt to get Google Project if not set #489

Closed
drzero42 opened this issue Mar 9, 2018 · 5 comments
Closed

Comments

@drzero42
Copy link
Contributor

drzero42 commented Mar 9, 2018

My use-case:
I currently run external-dns in my clusters with a deployment that uses this argument:
--google-project=$(GOOGLE_PROJECT)
It sets the env variable from a configmap that is populated by Terraform, when the cluster is created.
This makes it possible for me to reuse the same yaml-file for all of my clusters.
I would however like to deploy at least the standard components on my clusters with Helm, and the Helm chart does not allow me to set envs based on configmaps not created by the chart, so I have to tell the Helm chart the Google Project at deploy time.

This can of cause be fixed in the chart, but it would be really nice, if external-dns would attempt to find the Google Project on it's own, if the provider is specified to be Google, and no Project is given.

This is a fairly easy thing to do, you just need to do an HTTP GET on http://metadata.google.internal/computeMetadata/v1/project/project-id with this header set: "Metadata-Flavor: Google".

@hjacobs
Copy link
Contributor

hjacobs commented Mar 9, 2018

@drzero42 would you be willing to contribute a PR?

@drzero42
Copy link
Contributor Author

@hjacobs I'll give it a try - not the most experienced Go-programmer, so will probably need some guidance for some things.

@linki
Copy link
Member

linki commented Mar 12, 2018

@drzero42 Good idea. Instead of making the HTTP calls yourself I think you can use Google's metadata package to take care of this for you: https://godoc.org/cloud.google.com/go/compute/metadata#ProjectID

Keep in mind that there are people that manage their Google DNS records in another project as well as people managing a Google domain from a cluster running somewhere else. This could also help: https://godoc.org/cloud.google.com/go/compute/metadata#OnGCE

@drzero42
Copy link
Contributor Author

@linki Yeah, I was thinking that Google would probably have a Go library to handle it. I'll look into using that.
I would not want to replace the ability to set the project, just have auto-detect as a fallback, if no project name is provided. If you then run on something other than Googles infrastructure, external-dns would error out like it does today, if no project name is provided.

@linki
Copy link
Member

linki commented Apr 23, 2018

Closed in #492 🎉 Thanks @drzero42

@linki linki closed this as completed Apr 23, 2018
lou-lan pushed a commit to lou-lan/external-dns that referenced this issue May 11, 2022
* Add util to assert correct krew setup

Homebrew refuses to add a post-install message for setting up
the PATH variable with krew's plugin store. Therefore we need
to check this on our side to warn users about an incomplete
setup. The goal is to
- print specific instructions for each shell/OS.
- not print the instructions when krew installs itself.

* Comments
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

No branches or pull requests

3 participants