Skip to content

Conversation

@michaeljmarshall
Copy link
Member

Motivation

The Pulsar broker, proxy, websocket proxy, and function worker each start several clients, including the Pulsar Client, the Pulsar Admin Client, and the Bookkeeper Client. Until now, there hasn't been an easy way to pass arbitrary configuration to these clients, which can cause problems. A recent example is the client memory limit that we fixed here: #15752. I propose that we enable pass through configuration for these clients, so that users can override any default configuration.

Enable pass through configuration support for the bookkeeper clients created by DistributedLog and BookKeeperPackagesStorage. This support is already present for the managed ledger bookkeeper client, which takes all bookkeeper_ prefixed configs. In order to simplify configuration, I reused the bookkeeper_ prefix since it's reasonable to assume that these configs will be the same.

Enable pass through configuration support for the broker clients using the brokerClient_ prefix. Note that setting this once affects all clients. I think this is ideal, but it could lead to some confusion. A good secondary feature might be to add another prefix that targets specific clients, like the replication client.

Initially implemented as #15763, but instead of submitting many PRs, I am just submitting one larger one.

Modifications

  • Update all Broker, Proxy, WebSocket Proxy, and Function Worker clients so they can take arbitrary config. The Pulsar Client and the Pulsar Admin Client take configuration starting with brokerClient_. The Bookkeeper Client and the DLog Bookeeper Client take configuration starting with bookkeeper_.
  • Create PropertiesUtils class to reduce code duplication for mapping prefixed properties to the Map<String, Object>
  • Add PulsarAdminBuilder#loadConf method to the interface to match the same method in the Pulsar Client builder.
  • Update the BookKeeperPackagesStorageConfiguration to expose the underlying properties object.
  • Add documentation to the broker.conf, the proxy.conf, the websocket.conf and the functions_worker.yml files.

Verifying this change

I added several tests and also manually verified that the configuration overrides applied.

Alternative Implementation

I had initially wanted to run the override logic at the end of all other configuration. However, it doesn't work correctly because of the issue highlighted here #8509. It might be helpful to change the implementation of the loadConf logic so that it doesn't serialize secrets as ****.

Does this pull request potentially affect one of the following parts:

This is a backwards compatible change. The only nuance is that the package management dlog bookie client will inherit the same configs that the broker already uses for the bookie client. I think this is preferable.

Copy link
Member

@dave2wave dave2wave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - nicely done!

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff

}

@Override
public PulsarAdminBuilder loadConf(Map<String, Object> config) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great ! I have seen a few issues requesting this feature !

@eolivelli eolivelli merged commit aa67349 into apache:master Jun 1, 2022
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lhotari pushed a commit that referenced this pull request Jun 1, 2022
lhotari pushed a commit that referenced this pull request Jun 1, 2022
lhotari pushed a commit that referenced this pull request Jun 1, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jun 1, 2022
…fig (apache#15818)

(cherry picked from commit aa67349)
(cherry picked from commit d144f1e)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jun 1, 2022
…fig (apache#15818)

(cherry picked from commit aa67349)
(cherry picked from commit d384076)
@lhotari lhotari added cherry-picked/branch-2.8 Archived: 2.8 is end of life cherry-picked/branch-2.9 Archived: 2.9 is end of life labels Jun 1, 2022
lhotari pushed a commit that referenced this pull request Jun 1, 2022
@michaeljmarshall michaeljmarshall deleted the make-clients-arbitrarily-configurable branch June 1, 2022 19:12
@lhotari lhotari added cherry-picked/branch-2.7 Archived: 2.7 is end of life release/2.7.5 labels Jun 2, 2022
@momo-jun
Copy link
Contributor

momo-jun commented Jul 6, 2022

Hi @michaeljmarshall , thanks for updating the docs. I have a quick question regarding the label "release/2.10.1".

The doc changes you made in this PR are not shown in 2.10/2.10.1 documentation, but only in the latest (master). Should they be synced to 2.10/2.10.1 doc or it's just mislabeled?

BTW, there is something wrong with the table formatting.
image

//cc @Anonymitaet

@michaeljmarshall
Copy link
Member Author

@momo-jun - here is a PR adding docs to 2.10.1: #16410. Note that I couldn't have added the docs to 2.10.1 when the PR was added because those docs were not yet created. Similarly, there are not 2.8.4 docs or 2.9.3 docs.

@momo-jun
Copy link
Contributor

momo-jun commented Jul 6, 2022

@michaeljmarshall thanks for the clarification.
Maybe we need to set up a sub-process to make sure these doc changes can be synced as soon as the docs for a new release are created, and can be backward-synced to versioned docs like 2.8.4 and 2.9.3 in this case. So they won't be missed.

@michaeljmarshall
Copy link
Member Author

@momo-jun - sure, I agree we could improve the process. This partially comes down to how we version docs. We could use some kind of -SNAPSHOT doc directory for each release branch, and then when releases are performed, we copy those docs to the next release version. It could be something different, too. The main nuance is that we shouldn't make future versions of the docs available on the website because that would create confusion.

momo-jun added a commit to momo-jun/pulsar that referenced this pull request Aug 4, 2022
momo-jun added a commit to momo-jun/pulsar that referenced this pull request Aug 5, 2022
michaeljmarshall added a commit to datastax/pulsar that referenced this pull request Sep 16, 2022
…fig (apache#15818)

(cherry picked from commit aa67349)
(cherry picked from commit e5d035a)
michaeljmarshall added a commit that referenced this pull request Mar 1, 2023
…19674)

### Motivation

When we merged #15818 in order to make the broker's client configurable, we did not add an explicit config for hostname verification. This PR adds that config to the broker and the websocket proxy. I chose the name `tlsHostnameVerificationEnabled` because that is what is already used in the proxy. It diverges from the function worker's config of `tlsEnableHostnameVerification`.

Before this PR, you would have enabled hostname verification by configuring `brokerClient_tlsHostnameVerificationEnable=true` in the broker and WS proxy configs. (Note that the variable name is slightly different because the `ClientConfiguration` does not have a `d` at the end of its name.

The remaining follow up work will be to update the `ClusterData` objects to configure hostname verification there to make it easier to configure hostname verification for remote clusters.

### Modifications

* Add `tlsHostnameVerificationEnabled` to the `broker.conf` and the `proxy.conf`
* Update all of the relevant locations that were previously only relying on `brokerClient_tlsHostnameVerificationEnable`

### Verifying this change

I added a single test to ensure that the `WebSocketProxyConfiguration` properly converts to the `ServiceConfiguration` object.

Otherwise, I verified that anywhere we are using `"brokerClient_"`, this PR also adds the right configuration.

### Does this pull request potentially affect one of the following parts:

This PR introduces a "new" configuration key, but not a new concept. All underlying behaviors are unchanged.

### Documentation

- [x] `doc-not-needed`

Docs are automatically updated by these changes.
michaeljmarshall added a commit that referenced this pull request Mar 1, 2023
…19674)

When we merged #15818 in order to make the broker's client configurable, we did not add an explicit config for hostname verification. This PR adds that config to the broker and the websocket proxy. I chose the name `tlsHostnameVerificationEnabled` because that is what is already used in the proxy. It diverges from the function worker's config of `tlsEnableHostnameVerification`.

Before this PR, you would have enabled hostname verification by configuring `brokerClient_tlsHostnameVerificationEnable=true` in the broker and WS proxy configs. (Note that the variable name is slightly different because the `ClientConfiguration` does not have a `d` at the end of its name.

The remaining follow up work will be to update the `ClusterData` objects to configure hostname verification there to make it easier to configure hostname verification for remote clusters.

* Add `tlsHostnameVerificationEnabled` to the `broker.conf` and the `proxy.conf`
* Update all of the relevant locations that were previously only relying on `brokerClient_tlsHostnameVerificationEnable`

I added a single test to ensure that the `WebSocketProxyConfiguration` properly converts to the `ServiceConfiguration` object.

Otherwise, I verified that anywhere we are using `"brokerClient_"`, this PR also adds the right configuration.

This PR introduces a "new" configuration key, but not a new concept. All underlying behaviors are unchanged.

- [x] `doc-not-needed`

Docs are automatically updated by these changes.

(cherry picked from commit 6621fd3)
michaeljmarshall added a commit that referenced this pull request Mar 1, 2023
…19674)

When we merged #15818 in order to make the broker's client configurable, we did not add an explicit config for hostname verification. This PR adds that config to the broker and the websocket proxy. I chose the name `tlsHostnameVerificationEnabled` because that is what is already used in the proxy. It diverges from the function worker's config of `tlsEnableHostnameVerification`.

Before this PR, you would have enabled hostname verification by configuring `brokerClient_tlsHostnameVerificationEnable=true` in the broker and WS proxy configs. (Note that the variable name is slightly different because the `ClientConfiguration` does not have a `d` at the end of its name.

The remaining follow up work will be to update the `ClusterData` objects to configure hostname verification there to make it easier to configure hostname verification for remote clusters.

* Add `tlsHostnameVerificationEnabled` to the `broker.conf` and the `proxy.conf`
* Update all of the relevant locations that were previously only relying on `brokerClient_tlsHostnameVerificationEnable`

I added a single test to ensure that the `WebSocketProxyConfiguration` properly converts to the `ServiceConfiguration` object.

Otherwise, I verified that anywhere we are using `"brokerClient_"`, this PR also adds the right configuration.

This PR introduces a "new" configuration key, but not a new concept. All underlying behaviors are unchanged.

- [x] `doc-not-needed`

Docs are automatically updated by these changes.

(cherry picked from commit 6621fd3)
(cherry picked from commit b8083b0)
michaeljmarshall added a commit that referenced this pull request Mar 1, 2023
…19674)

When we merged #15818 in order to make the broker's client configurable, we did not add an explicit config for hostname verification. This PR adds that config to the broker and the websocket proxy. I chose the name `tlsHostnameVerificationEnabled` because that is what is already used in the proxy. It diverges from the function worker's config of `tlsEnableHostnameVerification`.

Before this PR, you would have enabled hostname verification by configuring `brokerClient_tlsHostnameVerificationEnable=true` in the broker and WS proxy configs. (Note that the variable name is slightly different because the `ClientConfiguration` does not have a `d` at the end of its name.

The remaining follow up work will be to update the `ClusterData` objects to configure hostname verification there to make it easier to configure hostname verification for remote clusters.

* Add `tlsHostnameVerificationEnabled` to the `broker.conf` and the `proxy.conf`
* Update all of the relevant locations that were previously only relying on `brokerClient_tlsHostnameVerificationEnable`

I added a single test to ensure that the `WebSocketProxyConfiguration` properly converts to the `ServiceConfiguration` object.

Otherwise, I verified that anywhere we are using `"brokerClient_"`, this PR also adds the right configuration.

This PR introduces a "new" configuration key, but not a new concept. All underlying behaviors are unchanged.

- [x] `doc-not-needed`

Docs are automatically updated by these changes.

(cherry picked from commit 6621fd3)
(cherry picked from commit b8083b0)
(cherry picked from commit a3a242c)
michaeljmarshall added a commit that referenced this pull request Mar 1, 2023
…19674)

When we merged #15818 in order to make the broker's client configurable, we did not add an explicit config for hostname verification. This PR adds that config to the broker and the websocket proxy. I chose the name `tlsHostnameVerificationEnabled` because that is what is already used in the proxy. It diverges from the function worker's config of `tlsEnableHostnameVerification`.

Before this PR, you would have enabled hostname verification by configuring `brokerClient_tlsHostnameVerificationEnable=true` in the broker and WS proxy configs. (Note that the variable name is slightly different because the `ClientConfiguration` does not have a `d` at the end of its name.

The remaining follow up work will be to update the `ClusterData` objects to configure hostname verification there to make it easier to configure hostname verification for remote clusters.

* Add `tlsHostnameVerificationEnabled` to the `broker.conf` and the `proxy.conf`
* Update all of the relevant locations that were previously only relying on `brokerClient_tlsHostnameVerificationEnable`

I added a single test to ensure that the `WebSocketProxyConfiguration` properly converts to the `ServiceConfiguration` object.

Otherwise, I verified that anywhere we are using `"brokerClient_"`, this PR also adds the right configuration.

This PR introduces a "new" configuration key, but not a new concept. All underlying behaviors are unchanged.

- [x] `doc-not-needed`

Docs are automatically updated by these changes.

(cherry picked from commit 6621fd3)
(cherry picked from commit b8083b0)
(cherry picked from commit a3a242c)
(cherry picked from commit c84c3b7)
Annavar-satish pushed a commit to pandio-com/pulsar that referenced this pull request Mar 6, 2023
…pache#19674)

When we merged apache#15818 in order to make the broker's client configurable, we did not add an explicit config for hostname verification. This PR adds that config to the broker and the websocket proxy. I chose the name `tlsHostnameVerificationEnabled` because that is what is already used in the proxy. It diverges from the function worker's config of `tlsEnableHostnameVerification`.

Before this PR, you would have enabled hostname verification by configuring `brokerClient_tlsHostnameVerificationEnable=true` in the broker and WS proxy configs. (Note that the variable name is slightly different because the `ClientConfiguration` does not have a `d` at the end of its name.

The remaining follow up work will be to update the `ClusterData` objects to configure hostname verification there to make it easier to configure hostname verification for remote clusters.

* Add `tlsHostnameVerificationEnabled` to the `broker.conf` and the `proxy.conf`
* Update all of the relevant locations that were previously only relying on `brokerClient_tlsHostnameVerificationEnable`

I added a single test to ensure that the `WebSocketProxyConfiguration` properly converts to the `ServiceConfiguration` object.

Otherwise, I verified that anywhere we are using `"brokerClient_"`, this PR also adds the right configuration.

This PR introduces a "new" configuration key, but not a new concept. All underlying behaviors are unchanged.

- [x] `doc-not-needed`

Docs are automatically updated by these changes.

(cherry picked from commit 6621fd3)
(cherry picked from commit b8083b0)
(cherry picked from commit a3a242c)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Mar 9, 2023
…pache#19674)

When we merged apache#15818 in order to make the broker's client configurable, we did not add an explicit config for hostname verification. This PR adds that config to the broker and the websocket proxy. I chose the name `tlsHostnameVerificationEnabled` because that is what is already used in the proxy. It diverges from the function worker's config of `tlsEnableHostnameVerification`.

Before this PR, you would have enabled hostname verification by configuring `brokerClient_tlsHostnameVerificationEnable=true` in the broker and WS proxy configs. (Note that the variable name is slightly different because the `ClientConfiguration` does not have a `d` at the end of its name.

The remaining follow up work will be to update the `ClusterData` objects to configure hostname verification there to make it easier to configure hostname verification for remote clusters.

* Add `tlsHostnameVerificationEnabled` to the `broker.conf` and the `proxy.conf`
* Update all of the relevant locations that were previously only relying on `brokerClient_tlsHostnameVerificationEnable`

I added a single test to ensure that the `WebSocketProxyConfiguration` properly converts to the `ServiceConfiguration` object.

Otherwise, I verified that anywhere we are using `"brokerClient_"`, this PR also adds the right configuration.

This PR introduces a "new" configuration key, but not a new concept. All underlying behaviors are unchanged.

- [x] `doc-not-needed`

Docs are automatically updated by these changes.

(cherry picked from commit 6621fd3)
(cherry picked from commit b8083b0)
(cherry picked from commit a3a242c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/broker area/config area/function area/proxy cherry-picked/branch-2.7 Archived: 2.7 is end of life cherry-picked/branch-2.8 Archived: 2.8 is end of life cherry-picked/branch-2.9 Archived: 2.9 is end of life cherry-picked/branch-2.10 doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. release/2.7.5 release/2.8.4 release/2.9.3 release/2.10.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants