michaeljmarshall opened a new pull request #11468:
URL: https://github.com/apache/pulsar/pull/11468
…rConfig
### Motivation
Currently, it is not possible to pass custom configuration to a function
worker for use in an Authentication or Authorization plugin. In order to
support plugins created by end users, we need to make sure that configurations
passed in at function worker initialization are passed through to the
`ServiceConfiguration`. This PR seeks to make it possible to pass in those
arbitrary configurations.
### Modifications
Update the `FunctionWorkerStarter` class to generate the
`ServiceConfiguration` by reading it in from a file instead of building the
class by converting the `WorkerConfig` to the `ServiceConfiguration`.
### Alternative Solution
We could also change how we generate the `WorkerConfig`. It is currently
created by reading the config file into the class using an ObjectMapper. This
does not really follow the general paradigm that Pulsar uses to generate config
classes (at least the paradigm that I've noticed) where we use the
`PulsarConfigurationLoader` class to load a config from a file. However, I am
not sure that we want to remove the `WorkerConfig.load` method, given that it
appears well tested.
I'm open to this solution as well. Please let me know what you think.
### Verifying this change
There are not currently tests validating this configuration logic. I'm happy
to add a test, but I'm not sure where to add it. Please let me know how to
proceed here.
Note that the only change in behavior here is that the
`ServiceConfiguration` class will now have fields that were not present in the
`WorkerConfig`. Previously, these fields would have been dropped when we
created the `WorkerConfig`. As such, while this change will technically
introduce changes to the configuration in the `ServiceConfiguration` class, it
is only changing configuration for fields not present in the `WorkerConfig`.
Additionally, one potential difference could also come from differences in
default values between the `WorkerConfig` and the `ServiceConfiguration`. There
could be conflicts now, or in the future, that could make it confusing to
figure out which configuration is _actually_ applied. This might be worth
adding test coverage.
Note, also, that the `ServiceConfigruation` added in this PR is only used to
configure the `AuthenticationService` and the `AuthorizationService`.
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): no
- The public API: no
- The schema: no
- The default values of configurations: **possibly**
- The wire protocol: no
- The rest endpoints: no
- The admin cli options: no
- Anything that affects deployment: **yes (custom configuration)**
### Documentation
#### For contributor
For this PR, do we need to update docs?
I don't think additional documentation is needed because I think this change
will make pulsar's configuration work as expected.
#### For committer
For this PR, do we need to update docs?
- If yes,
- if you update docs in this PR, label this PR with the `doc` label.
- if you plan to update docs later, label this PR with the `doc-required`
label.
- if you need help on updating docs, create a follow-up issue with the
`doc-required` label.
- If no, label this PR with the `no-need-doc` label and explain why.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]