pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[improve][fn] Add Go support for pulsar function secrets

Open DavidRayner opened this issue 1 year ago • 0 comments

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 secretsProviderClassName and secretsProviderConfig are passed to Go pulsar functions.
  • The default secretsProviderClassName for Go functions has been set to ClearTextSecretsProvider
  • Go pulsar function start-up has been updated to setup the secrets provider.
  • A new Go method GetSecretValue has been added to the FunctionContext type 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 secretsProviderClassName and secretsProviderConfig are passed to the Go function.
  • New Go unit tests have been written to test the GetValue method for the two Go SecretsProvider implementations

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

DavidRayner avatar May 23 '24 12:05 DavidRayner