Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .chloggen/435960-fix-oauth2-flow-pulsar-exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
component: exporter/pulsar

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fix the oauth2 flow for pulsar exporter by adding additional configuration fields

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [435960]

# (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: Fixes the oauth2 authentication flow in pulsar exporter by exposing additional configuration like `private_key` and `scope`.

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
28 changes: 28 additions & 0 deletions .chloggen/435960-fix-oauth2-flow-pulsar-receiver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
component: receiver/pulsar

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fix the oauth2 flow for pulsar exporter by adding additional configuration fields

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [435960]

# (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: |
Fixes the oauth2 authentication flow in pulsar receiver by exposing additional configuration like `private_key` and `scope`.

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
2 changes: 2 additions & 0 deletions exporter/pulsarexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ The following settings can be optionally configured:
- `issuer_url`:
- `client_id`:
- `audience`:
- `scope`:
- `private_key`: Path to the private client credentials json file. Must contain `type`, `client_id`, `client_secret` and `issuer_url` fields.
- `athenz`
- `provider_domain`:
- `tenant_domain`:
Expand Down
17 changes: 11 additions & 6 deletions exporter/pulsarexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ type Athenz struct {
}

type OAuth2 struct {
IssuerURL string `mapstructure:"issuer_url"`
ClientID string `mapstructure:"client_id"`
Audience string `mapstructure:"audience"`
IssuerURL string `mapstructure:"issuer_url"`
ClientID string `mapstructure:"client_id"`
Audience string `mapstructure:"audience"`
PrivateKey string `mapstructure:"private_key"`
Scope string `mapstructure:"scope"`
}

// Producer defines configuration for producer
Expand Down Expand Up @@ -107,9 +109,12 @@ func (cfg *Config) auth() pulsar.Authentication {
if authentication.OAuth2.HasValue() {
oauth2Cfg := authentication.OAuth2.Get()
return pulsar.NewAuthenticationOAuth2(map[string]string{
"issuerUrl": oauth2Cfg.IssuerURL,
"clientId": oauth2Cfg.ClientID,
"audience": oauth2Cfg.Audience,
"type": "client_credentials",
"issuerUrl": oauth2Cfg.IssuerURL,
"clientId": oauth2Cfg.ClientID,
"audience": oauth2Cfg.Audience,
"scope": oauth2Cfg.Scope,
"privateKey": oauth2Cfg.PrivateKey,
})
}
if authentication.Athenz.HasValue() {
Expand Down
2 changes: 2 additions & 0 deletions receiver/pulsarreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ The following settings can be optionally configured:
- `issuer_url`:
- `client_id`:
- `audience`:
- `scope`:
- `private_key`: Path to the private client credentials json file. Must contain `type`, `client_id`, `client_secret` and `issuer_url` fields.
- `athenz`
- `provider_domain`:
- `tenant_domain`:
Expand Down
17 changes: 11 additions & 6 deletions receiver/pulsarreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ type Athenz struct {
}

type OAuth2 struct {
IssuerURL string `mapstructure:"issuer_url"`
ClientID string `mapstructure:"client_id"`
Audience string `mapstructure:"audience"`
IssuerURL string `mapstructure:"issuer_url"`
ClientID string `mapstructure:"client_id"`
Audience string `mapstructure:"audience"`
PrivateKey string `mapstructure:"private_key"`
Scope string `mapstructure:"scope"`
}

var _ component.Config = (*Config)(nil)
Expand All @@ -83,9 +85,12 @@ func (cfg *Config) auth() pulsar.Authentication {
if authentication.OAuth2.HasValue() {
oauth2 := authentication.OAuth2.Get()
return pulsar.NewAuthenticationOAuth2(map[string]string{
"issuerUrl": oauth2.IssuerURL,
"clientId": oauth2.ClientID,
"audience": oauth2.Audience,
"type": "client_credentials",
"issuerUrl": oauth2.IssuerURL,
"clientId": oauth2.ClientID,
"audience": oauth2.Audience,
"scope": oauth2.Scope,
"privateKey": oauth2.PrivateKey,
})
}
if authentication.Athenz.HasValue() {
Expand Down
Loading