[feature][Function Worker] Support disabling non-TLS service port #15328
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.
Master Issue: #11548
Motivation
Some use security sensitive users prefer to disable plaintext ports to ensure that there is no accidentally non-encrypted traffic. We added the ability to disable the non-TLS server on the broker #11681, and this PR adds the same feature for the function worker.
I have two questions about the implementation:
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
Lines 1681 to 1685 in 74eae1a
initializeWorkerConfigFromBrokerConfigmethod, I am updating the worker config so that it maps the broker's ports to the worker's ports for all values. This seems logical to me since there are so many other mapped ports, and when a user is disabling the plaintext port on the broker, it's highly likely that they'd also want to disable the plaintext port for the broker's function worker.Modifications
workerPortisnullWorkerConfig#getWorkerId()so that it uses the TLS port when the plaintext port is null.initializeWorkerConfigFromBrokerConfigmethod to align with the new changes.Verifying this change
I added a test and verified the associated logs, too.
Does this pull request potentially affect one of the following parts:
This change does not affect any defaults.
Documentation
doc-addedThis PR includes updates to the docs.