-
Notifications
You must be signed in to change notification settings - Fork 3k
Added a New Provider Component - Google Secrets Provider #39790
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
0e0f1e4
created a new provider
XuechunHou 6dcd5c2
Merge remote-tracking branch 'upstream/main' into google-secret-provider
XuechunHou 3a72bf7
google secret provider implementation
XuechunHou dca1219
Merge remote-tracking branch 'upstream/main' into google-secret-provider
XuechunHou 978a03d
cast error to apiError before returning to caller
XuechunHou 427a943
updated secret provider impl, and ran auto generation tool
XuechunHou 6b3bb42
Merge remote-tracking branch 'upstream/main' into google-secret-provider
XuechunHou e6e2e63
updated codeowner and added the changelog
XuechunHou 667b3f1
Merge pull request #1 from XuechunHou/google-secret-provider
XuechunHou 72d62dc
removed ineligible code owners
XuechunHou f37580d
changed the code owner to the author of this provider
XuechunHou 3065fca
fixed extra : in error msg
XuechunHou 17b6d0f
Merge remote-tracking branch 'upstream/main'
XuechunHou 5deede8
renamed the provider from googlesecretsprovider to googlesecretmanage…
XuechunHou 793cea5
updated wording in the readme file.
XuechunHou 2ba11df
updated readme to mention ADC
XuechunHou c3c2e09
renamed directory
XuechunHou 7ca7813
addressed comments in tests
XuechunHou 666b4f5
Merge remote-tracking branch 'upstream/main'
XuechunHou a0fb2aa
updated code owner to XuechunHou
XuechunHou f8db4b1
close secret manager client in Shutdown, so that the network conencti…
XuechunHou ee31d6c
unlock regardless of secret manager client being nil or non-nil in th…
XuechunHou 9a9a372
fixed test function name
XuechunHou ee136df
resolved comments
XuechunHou 251fdad
resolved comments
XuechunHou 03e5cba
does not reset provider.client to nil
XuechunHou 03bb82f
resolved comments
XuechunHou 80df598
un-export mockSecretsManagerClient
XuechunHou 3a55f0f
removed thread safe implementation
XuechunHou 3d976e9
removed codeowner
XuechunHou 75d36a4
added braydon as code owner
XuechunHou e803f6a
removed unit test
XuechunHou b179c11
updated codeowner
XuechunHou 940ac69
Merge branch 'open-telemetry:main' into main
XuechunHou 0681cc1
trying to fix codeowner workflow
XuechunHou 158ab54
fixing codeowner workflow
XuechunHou 4cf7bf7
fixing the ordering in codeowner file
XuechunHou 6ebfbf6
fixed component list ordering
XuechunHou 200424e
Merge branch 'main' into main
XuechunHou d5dda73
updated go to 1.23 in go.mod
XuechunHou 60398c8
Merge branch 'main' of github.com:XuechunHou/opentelemetry-collector-…
XuechunHou 261c016
fixed lint and formatting issue
XuechunHou 4256877
ran make gotidy
XuechunHou 09170e0
ran make tidylist
XuechunHou c63d67a
fixed lint error
XuechunHou 81f13a7
ran make genlabels
XuechunHou 3db0ace
ran make gencodecov
XuechunHou 47780f9
Merge remote-tracking branch 'upstream/main'
XuechunHou c68c24b
Merge remote-tracking branch 'upstream/main'
XuechunHou 427594e
Merge remote-tracking branch 'upstream/main'
XuechunHou ce21e07
Merge remote-tracking branch 'upstream/main'
XuechunHou 35c4af3
Merge branch 'main' into main
braydonk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: new_component | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: confmap/googlesecretsprovider | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Initial implementation of secrets manager provider. Allows fetch secrets from Google Secrets Manager | ||
|
||
# One or more tracking issues related to the change | ||
issues: [39665] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../../Makefile.Common |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Google Secrets Provider | ||
<!-- status autogenerated section --> | ||
| Status | | | ||
| ------------- |-----------| | ||
| Stability | [development] | | ||
| Distributions | [] | | ||
| Issues | [](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aprovider%2Fgooglesecretsprovider) [](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aprovider%2Fgooglesecretsprovider) | | ||
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@XuechunHou](https://www.github.com/XuechunHou) | | ||
|
||
[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development | ||
<!-- end autogenerated section --> | ||
|
||
## Summary | ||
|
||
This Provider component offers Otel users a secure way to reference secrets or sensitive information in their Otel Collector configurations using [Google Secret Manager](https://cloud.google.com/security/products/secret-manager). Users place placeholders in the format `${googlesecretsprovider:projects/<project Id>/secrets/<secret Id>/versions/<version Id>}` within their configurations. The actual secrets will then be fetched dynamically from [Google Secret Manager](https://cloud.google.com/security/products/secret-manager) during Otel Collector initialization. | ||
XuechunHou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## How it works | ||
XuechunHou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- Simply replace plaintext secrets within the Otel configurations with the placeholder: `${googlesecretsprovider:projects/<project Id>/secrets/<secret Id>/versions/<version Id>}` | ||
|
||
An example Otel configuration: | ||
|
||
``` | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
processors: | ||
batch: | ||
|
||
exporters: | ||
logging: | ||
loglevel: debug | ||
http: | ||
endpoint: "https://example.com/api/metrics" | ||
headers: | ||
X-API-Key: ${googlesecretsprovider:projects/12345/secrets/my-secret/versions/1} | ||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [logging, http] | ||
metrics: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [logging, http] | ||
logs: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [logging, http] | ||
|
||
``` | ||
|
||
### Prerequisites | ||
XuechunHou marked this conversation as resolved.
Show resolved
Hide resolved
|
||
1. Make sure to enable access to the [Secret Manager API](https://cloud.google.com/secret-manager/docs/accessing-the-api). | ||
2. Make sure to [add the secret entries to Google Secret Manager](https://cloud.google.com/secret-manager/docs/create-secret-quickstart) before referencing them in the Otel configurations. | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
confmap/provider/googlesecretsprovider/generated_package_test.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
module github.com/open-telemetry/opentelemetry-collector-contrib/confmap/provider/googlesecretsprovider | ||
|
||
go 1.25 | ||
|
||
require ( | ||
cloud.google.com/go/secretmanager v1.14.7 | ||
github.com/googleapis/gax-go/v2 v2.14.1 | ||
github.com/stretchr/testify v1.10.0 | ||
go.opentelemetry.io/collector/confmap v1.30.0 | ||
go.uber.org/goleak v1.3.0 | ||
) | ||
|
||
require ( | ||
cloud.google.com/go/auth v0.16.0 // indirect | ||
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect | ||
cloud.google.com/go/compute/metadata v0.6.0 // indirect | ||
cloud.google.com/go/iam v1.5.0 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/felixge/httpsnoop v1.0.4 // indirect | ||
github.com/go-logr/logr v1.4.2 // indirect | ||
github.com/go-logr/stdr v1.2.2 // indirect | ||
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect | ||
github.com/google/s2a-go v0.1.9 // indirect | ||
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect | ||
github.com/hashicorp/go-version v1.7.0 // indirect | ||
github.com/knadh/koanf/maps v0.1.2 // indirect | ||
github.com/knadh/koanf/providers/confmap v0.1.0 // indirect | ||
github.com/knadh/koanf/v2 v2.1.2 // indirect | ||
github.com/mitchellh/copystructure v1.2.0 // indirect | ||
github.com/mitchellh/reflectwalk v1.0.2 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect | ||
go.opentelemetry.io/collector/featuregate v1.30.0 // indirect | ||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect | ||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect | ||
go.opentelemetry.io/otel v1.35.0 // indirect | ||
go.opentelemetry.io/otel/metric v1.35.0 // indirect | ||
go.opentelemetry.io/otel/trace v1.35.0 // indirect | ||
go.uber.org/multierr v1.11.0 // indirect | ||
go.uber.org/zap v1.27.0 // indirect | ||
golang.org/x/crypto v0.37.0 // indirect | ||
golang.org/x/net v0.39.0 // indirect | ||
golang.org/x/oauth2 v0.29.0 // indirect | ||
golang.org/x/sync v0.13.0 // indirect | ||
golang.org/x/sys v0.32.0 // indirect | ||
golang.org/x/text v0.24.0 // indirect | ||
golang.org/x/time v0.11.0 // indirect | ||
google.golang.org/api v0.229.0 // indirect | ||
google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb // indirect | ||
google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e // indirect | ||
google.golang.org/grpc v1.71.1 // indirect | ||
google.golang.org/protobuf v1.36.6 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type: googlesecretsprovider | ||
|
||
status: | ||
class: provider | ||
stability: | ||
development: [provider] | ||
codeowners: | ||
active: [dashpole] | ||
XuechunHou marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.