diff --git a/.chloggen/pulsar-use-configopaque.yaml b/.chloggen/pulsar-use-configopaque.yaml new file mode 100755 index 000000000000..a7ab8d4f6462 --- /dev/null +++ b/.chloggen/pulsar-use-configopaque.yaml @@ -0,0 +1,20 @@ +# Use this changelog template to create an entry for release notes. +# If your change doesn't affect end users, such as a test fix or a tooling change, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: receiver/pulsar + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Change the types of `Config.Authentication.Token.Token` and `Config.Authentication.Athenz.PrivateKey` to be `configopaque.String` + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [17273] + +# (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: diff --git a/receiver/pulsarreceiver/config.go b/receiver/pulsarreceiver/config.go index 96ba7edd2ffe..20b799e0cd3c 100644 --- a/receiver/pulsarreceiver/config.go +++ b/receiver/pulsarreceiver/config.go @@ -8,6 +8,7 @@ import ( "github.com/apache/pulsar-client-go/pulsar" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configopaque" ) type Config struct { @@ -42,17 +43,17 @@ type TLS struct { } type Token struct { - Token string `mapstructure:"token"` + Token configopaque.String `mapstructure:"token"` } type Athenz struct { - ProviderDomain string `mapstructure:"provider_domain"` - TenantDomain string `mapstructure:"tenant_domain"` - TenantService string `mapstructure:"tenant_service"` - PrivateKey string `mapstructure:"private_key"` - KeyID string `mapstructure:"key_id"` - PrincipalHeader string `mapstructure:"principal_header"` - ZtsURL string `mapstructure:"zts_url"` + ProviderDomain string `mapstructure:"provider_domain"` + TenantDomain string `mapstructure:"tenant_domain"` + TenantService string `mapstructure:"tenant_service"` + PrivateKey configopaque.String `mapstructure:"private_key"` + KeyID string `mapstructure:"key_id"` + PrincipalHeader string `mapstructure:"principal_header"` + ZtsURL string `mapstructure:"zts_url"` } type OAuth2 struct { @@ -74,7 +75,7 @@ func (cfg *Config) auth() pulsar.Authentication { return pulsar.NewAuthenticationTLS(authentication.TLS.CertFile, authentication.TLS.KeyFile) } if authentication.Token != nil { - return pulsar.NewAuthenticationToken(authentication.Token.Token) + return pulsar.NewAuthenticationToken(string(authentication.Token.Token)) } if authentication.OAuth2 != nil { return pulsar.NewAuthenticationOAuth2(map[string]string{ @@ -88,7 +89,7 @@ func (cfg *Config) auth() pulsar.Authentication { "providerDomain": authentication.Athenz.ProviderDomain, "tenantDomain": authentication.Athenz.TenantDomain, "tenantService": authentication.Athenz.TenantService, - "privateKey": authentication.Athenz.PrivateKey, + "privateKey": string(authentication.Athenz.PrivateKey), "keyId": authentication.Athenz.KeyID, "principalHeader": authentication.Athenz.PrincipalHeader, "ztsUrl": authentication.Athenz.ZtsURL, diff --git a/receiver/pulsarreceiver/go.mod b/receiver/pulsarreceiver/go.mod index 45f50076e000..9d800e7e9225 100644 --- a/receiver/pulsarreceiver/go.mod +++ b/receiver/pulsarreceiver/go.mod @@ -12,6 +12,7 @@ require ( github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/collector/component v0.81.0 + go.opentelemetry.io/collector/config/configopaque v0.81.0 go.opentelemetry.io/collector/confmap v0.81.0 go.opentelemetry.io/collector/consumer v0.81.0 go.opentelemetry.io/collector/pdata v1.0.0-rcv0013 diff --git a/receiver/pulsarreceiver/go.sum b/receiver/pulsarreceiver/go.sum index 2abf485a7923..057c96fe2ddc 100644 --- a/receiver/pulsarreceiver/go.sum +++ b/receiver/pulsarreceiver/go.sum @@ -481,6 +481,8 @@ go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/collector v0.81.0 h1:pF+sB8xNXlg/W0a0QTLz4mUWyool1a9toVj8LmLoFqg= go.opentelemetry.io/collector/component v0.81.0 h1:AKsl6bss/SRrW248GFpmGiiI/4kdemW92Ai/X82CCqY= go.opentelemetry.io/collector/component v0.81.0/go.mod h1:+m6/yPiJ7O7Oc/OLfmgUB2mrY1xoUqRj4BsoOtIVpGs= +go.opentelemetry.io/collector/config/configopaque v0.81.0 h1:MkCAGh0WydRWydETB9FLnuCj9hDPDiz2g4Wxnl53I0w= +go.opentelemetry.io/collector/config/configopaque v0.81.0/go.mod h1:pM1oy6gasukw3H6jAvc9Q9OtFaaY2IbfeuwCPAjOgXc= go.opentelemetry.io/collector/config/configtelemetry v0.81.0 h1:j3dhWbAcrfL1n0RmShRJf99X/xIMoPfEShN/5Z8bY0k= go.opentelemetry.io/collector/config/configtelemetry v0.81.0/go.mod h1:KEYQRiYJdx38iZkvcLKBZWH9fK4NeafxBwGRrRKMgyA= go.opentelemetry.io/collector/confmap v0.81.0 h1:AqweoBGdF3jGM2/KgP5GS6bmN+1aVrEiCy4nPf7IBE4=