[exporter/pulsar] [receiver/pulsar] Fix pulsarexporter and pulsarreceiver oauth2 flow #43596
+81
−12
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.
Description
As part of our project we needed Pulsar Exporter to work with oauth2 based IAM. But during configuration it was found that there is no proper way to provide
client_secretto the exporter. Going through the Pulsar Client code, I found the keys which are needed to add and updated the config of Pulsar Exporter and Receiver accordingly.Changes
scopeconfig field to accept Oauth2 scope valueprivate_keyconfig field to accept path to a private client credentials json fileTesting
Tested with Pulsar Cluster which is configured to work with OIDC Auth only in Kubernetes. Created the following k8s secret and mounted it inside the pod and configured the
private_keypath to it.{ "type": "client_credentials", "client_id": "pulsar-client", "client_secret": "<REDACTED>", "issuer_url": "https://example.com/oauth2" }Config
Able to successfully connect with Pulsar Cluster with this.
NOTE: If there is any error in Oauth2 flow, then the error is ignored. This is because Pulsar Client drops the error and does not return it during the
NewAuthenticationOAuth2flow.