-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
plugin/rest: Add GCP metadata server support #2938
plugin/rest: Add GCP metadata server support #2938
Conversation
d11fae9
to
3cdd195
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 Thanks a lot 🎉
Mostly questions inline, please bear with me. 🙃
|
||
request.Header.Add("Metadata-Flavor", "Google") | ||
|
||
timeout := time.Duration(5) * time.Second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hardcoded 5s looks weird. I suppose we could also use c.ResponseHeaderTimeoutSeconds
? https://github.com/open-policy-agent/opa/pull/2938/files#diff-99a9ce78de44f106d9f1ade633bb6c6f425af0e6704663032abb475bb00f3d37R83
Not worse than
Lines 308 to 309 in 5c6c963
// construct an HTTP client with a reasonably short timeout | |
client := &http.Client{Timeout: time.Second * 10} |
I guess there's some potential for improving the timeout config here cross the different plugins. Outside of the scope of this PR, of course.
94540e6
to
459ebd0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing my nitpicks. LGTM 😃
Adds support for fetching access and identity tokens from a GCP metadata server. Identity tokens are used to authenticate to third party applications running behind Google authentication proxies such as containers deployed to Google's Cloud Run. Access tokens are used to authenticate to first party GCP services such as Google Cloud Storage. Signed-off-by: Kelsey Hightower <kelsey.hightower@gmail.com>
ae9628d
to
28b566b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds support for fetching access and identity tokens from a GCP
metadata server. Identity tokens are used to authenticate to third
party applications running behind Google authentication proxies
such as containers deployed to Google's Cloud Run.
Access tokens are used to authenticate to first party GCP services
such as Google Cloud Storage.
Signed-off-by: Kelsey Hightower kelsey.hightower@gmail.com