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

feat(extension/googleclientauth): support id-token #851

Merged

Conversation

rinx
Copy link
Contributor

@rinx rinx commented May 20, 2024

This PR adds support for generating id-token.

I'm planning to deploy OpenTelemetry collector as a Cloud Run application.
I'd like to use Cloud Run's service-to-service authentication or Cloud IAP's programmatic authentication to keep it private.

By supporting id-token in the googleclientauth extension, OpenTelemetry collector can be used as a client for the private collector deployed as a Cloud Run.

@rinx rinx requested a review from a team as a code owner May 20, 2024 13:14
@rinx rinx force-pushed the extension-googleclientauth-support-idtoken branch from 888eaf2 to f702315 Compare May 20, 2024 13:33
@dashpole
Copy link
Contributor

I'm planning to deploy OpenTelemetry collector as a Cloud Run application.

To clarify, you are planning to run the OTel collector as a service in cloud run, and then use a different collector running elsewhere to send to the cloud run service?

@rinx
Copy link
Contributor Author

rinx commented May 20, 2024

To clarify, you are planning to run the OTel collector as a service in cloud run, and then use a different collector running elsewhere to send to the cloud run service?

That's right.
I'd like to run an OTel collector as a receiver service in Cloud Run, and deploy "sender" OTel collectors somewhere else (e.g. Cloud Run, GKE, or AWS services via workload identity federation).
This PR is for the "sender" role collectors.

@rinx rinx requested a review from damemi May 20, 2024 14:34
@rinx rinx force-pushed the extension-googleclientauth-support-idtoken branch from 036f229 to 7f35f75 Compare May 21, 2024 01:26
@rinx rinx force-pushed the extension-googleclientauth-support-idtoken branch from 7f35f75 to 290eb25 Compare May 21, 2024 01:27
extension/googleclientauthextension/factory.go Outdated Show resolved Hide resolved
extension/googleclientauthextension/factory.go Outdated Show resolved Hide resolved
extension/googleclientauthextension/config.go Outdated Show resolved Hide resolved
extension/googleclientauthextension/config.go Outdated Show resolved Hide resolved
extension/googleclientauthextension/config.go Outdated Show resolved Hide resolved
@dashpole
Copy link
Contributor

/gcbrun

Copy link

codecov bot commented May 21, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 62.81%. Comparing base (4caace7) to head (e2e0330).
Report is 17 commits behind head on main.

Files Patch % Lines
extension/googleclientauthextension/factory.go 85.71% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #851      +/-   ##
==========================================
+ Coverage   61.03%   62.81%   +1.77%     
==========================================
  Files          56       57       +1     
  Lines        5903     4935     -968     
==========================================
- Hits         3603     3100     -503     
+ Misses       2143     1675     -468     
- Partials      157      160       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

rinx added 3 commits May 22, 2024 09:31
@rinx rinx requested a review from dashpole May 22, 2024 00:56
Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

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

can you update http_test and grpc_test with cases that use the id_token token type, and check the resulting headers?

extension/googleclientauthextension/config.go Outdated Show resolved Hide resolved
@dashpole
Copy link
Contributor

/gcbrun

rinx and others added 2 commits May 22, 2024 21:42
@rinx
Copy link
Contributor Author

rinx commented May 22, 2024

can you update http_test and grpc_test with cases that use the id_token token type, and check the resulting headers?

added test cases that uses id_token.
However, I couldn't write a case for checking headers, because google.golang.org/api/idtoken requires a real GCP credentials.json for generating a token.

I've already confirm that this code works correctly in my real GCP project.

@dashpole
Copy link
Contributor

/gcbrun

@rinx
Copy link
Contributor Author

rinx commented May 28, 2024

@damemi Could you please review this PR again?

@damemi damemi merged commit 51ae889 into GoogleCloudPlatform:main May 28, 2024
28 checks passed
@rinx
Copy link
Contributor Author

rinx commented May 28, 2024

@dashpole @damemi Thanks!

codeboten referenced this pull request in open-telemetry/opentelemetry-collector-contrib Jun 19, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go)
| `v1.23.0` -> `v1.24.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fdetectors%2fgcp/v1.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fdetectors%2fgcp/v1.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fdetectors%2fgcp/v1.23.0/v1.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fdetectors%2fgcp/v1.23.0/v1.24.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go)
| `v0.47.0` -> `v0.48.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fexporter%2fcollector/v0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fexporter%2fcollector/v0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fexporter%2fcollector/v0.47.0/v0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fexporter%2fcollector/v0.47.0/v0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector/googlemanagedprometheus](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go)
| `v0.47.0` -> `v0.48.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fexporter%2fcollector%2fgooglemanagedprometheus/v0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fexporter%2fcollector%2fgooglemanagedprometheus/v0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fexporter%2fcollector%2fgooglemanagedprometheus/v0.47.0/v0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fGoogleCloudPlatform%2fopentelemetry-operations-go%2fexporter%2fcollector%2fgooglemanagedprometheus/v0.47.0/v0.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>GoogleCloudPlatform/opentelemetry-operations-go
(github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector)</summary>

###
[`v0.48.0`](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/releases/tag/v0.48.0):
v1.24.0 and v0.48.0

[Compare
Source](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/compare/v0.47.0...v0.48.0)

##### What's Changed

- Updating packages by
[@&#8203;avilevy18](https://github.com/avilevy18) in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/846](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/846)
- Bump go to v1.22.3 in ci by
[@&#8203;dashpole](https://github.com/dashpole) in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/849](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/849)
- Run e2e tests on GAE standard by
[@&#8203;aabmass](https://github.com/aabmass) in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/848](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/848)
- Add host.id as a fallback for instance by
[@&#8203;dashpole](https://github.com/dashpole) in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/852](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/852)
- feat(extension/googleclientauth): support id-token by
[@&#8203;rinx](https://github.com/rinx) in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/851](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/851)
- Add support for exponential histograms in the GMP exporter by
[@&#8203;dashpole](https://github.com/dashpole) in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/853](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/853)
- Add support for custom MR mapping by
[@&#8203;psx95](https://github.com/psx95) in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/854](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/854)
- Update CI go version to 1.22.4 by
[@&#8203;psx95](https://github.com/psx95) in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/859](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/859)
- prepare for v1.24.0/v0.48.0
([#&#8203;858](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/issues/858))
by [@&#8203;psx95](https://github.com/psx95) in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/860](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/860)

##### New Contributors

- [@&#8203;rinx](https://github.com/rinx) made their first
contribution in
[https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/851](https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/pull/851)

**Full Changelog**:
GoogleCloudPlatform/opentelemetry-operations-go@v0.47.0...v0.48.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MTAuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQxMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZWJvdCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <[email protected]>
Co-authored-by: Alex Boten <[email protected]>
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.

3 participants