pulsar
pulsar copied to clipboard
[improve][fn] Add Go support for pulsar function secrets
Fixes #8425
Motivation
Currently the Java and Python pulsar functions can access secrets that are set when functions are installed, but not pulsar functions written in Go.
Modifications
- The pulsar function runtime code has been updated so that
secretsProviderClassNameandsecretsProviderConfigare passed to Go pulsar functions. - The default
secretsProviderClassNamefor Go functions has been set toClearTextSecretsProvider - Go pulsar function start-up has been updated to setup the secrets provider.
- A new Go method
GetSecretValuehas been added to theFunctionContexttype so that a pulsar function can retrieve secrets.
Verifying this change
- [ ] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
- A pulsar function runtime unit test has been updated to ensure that
secretsProviderClassNameandsecretsProviderConfigare passed to the Go function. - New Go unit tests have been written to test the
GetValuemethod for the two GoSecretsProviderimplementations
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
- [ ] Dependencies (add or upgrade a dependency)
- [x] The public API
A new Go method GetSecretValue has been added to the FunctionContext type.
- [ ] The schema
- [x] The default values of configurations
The default secretsProviderClassName for Go functions has been set to ClearTextSecretsProvider
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
Documentation
- [ ]
doc - [x]
doc-required - [ ]
doc-not-needed - [ ]
doc-complete
Pulsar-site changes here: https://github.com/apache/pulsar-site/pull/903
Matching PR in forked repository
PR in forked repository: https://github.com/DavidRayner/pulsar/pull/3