You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Install the local helm chart with the values file specified: helm install --values examples/values-minikube-with-tls-and-jwt.yaml pulsar-ci ./charts/pulsar/
After waiting for a time, get logs from the broker: kubectl -n pulsar logs pulsar-ci-broker-0
The logs should demonstrate the problem. Expected behavior
A clear and concise description of what you expected to happen.
Although we check for a few TLS-related configurations (tlsTrustCertsFilePath, allowTlsInsecureConnection, enableTlsHostnameVerificationEnable) when we create the PulsarAdmin client, it doesn't appear that we ever resolve to obtain a TLS endpoint if TLS Authentication is enabled.
Describe the bug
After configuring TLS Authentication in Pulsar 2.6.1 with this helm chart: https://github.com/devinbost/pulsar-helm-chart/tree/tls-auth
the broker gets stuck in a restart loop due to the
WorkerService
crashing with:during the
WorkerService.start(..)
method execution.With TLS Authentication enabled, the endpoint above should be the TLS endpoint (https://pulsar-ci-broker-0.pulsar-ci-broker.pulsar.svc.cluster.local:8443/admin/v2/persistent/public/functions/assignments), not the non-TLS endpoint. This may be the reason why we're getting a 401 on the PUT for function/assignments upon the broker startup.
To Reproduce
Steps to reproduce the behavior:
Start minikube with an appropriate number of CPUs:
minikube start --memory=8192 --cpus=6 --cni=bridge
Run the following commands to setup the kubernetes environment, tokens, certs, and keys:
Install the local helm chart with the values file specified:
helm install --values examples/values-minikube-with-tls-and-jwt.yaml pulsar-ci ./charts/pulsar/
After waiting for a time, get logs from the broker:
kubectl -n pulsar logs pulsar-ci-broker-0
The logs should demonstrate the problem.
Expected behavior
A clear and concise description of what you expected to happen.
Environment
Additional Context
Here is the WorkerConfig provided to the WorkerService, as reported in the logs:
Clues and Possible Solution
The only admin endpoints in the
WorkerConfig
that are NOT TLS are:When we create the
brokerAdmin
client, we use thepulsarWebServiceUrl
: https://github.com/apache/pulsar/blob/master/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerService.java#L146The first PUT on the function assignment topic uses the
brokerAdmin
client here: https://github.com/apache/pulsar/blob/master/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerService.java#L169Although we check for a few TLS-related configurations (tlsTrustCertsFilePath, allowTlsInsecureConnection, enableTlsHostnameVerificationEnable) when we create the PulsarAdmin client, it doesn't appear that we ever resolve to obtain a TLS endpoint if TLS Authentication is enabled.
If a TLS endpoint is required to resolve the 401 response issue, we need to add logic to check if TLS Authentication is enabled; and when TLS Authentication is enabled, we need to use a TLS endpoint when creating the
AdminClient
instances, such asbrokerAdmin
.We could easily add the logic to resolve the correct URL to the brokerConfig class (
ServiceConfiguration
) since this class already knows ifbrokerClientTlsEnabled
is true/false: https://github.com/apache/pulsar/blob/master/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java#L1656Then, that value could be assigned to a property on
workerConfig
before injectingworkerConfig
into ourWorkerService
: https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java#L175I'd like to get some feedback on this proposal.
The text was updated successfully, but these errors were encountered: