Skip to content

Commit

Permalink
[pulsar] fix: use NettyServerCnxnFactory for zookeeper if tls is enab…
Browse files Browse the repository at this point in the history
…led (#988)

* fix: use NettyServerCnxnFactory for zookeeper if tls is enabled

* fix ci

* fix ci
  • Loading branch information
jiangpengcheng authored Apr 3, 2023
1 parent 8a9ee97 commit beee2e6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .ci/clusters/values-function.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ proxy:

toolset:
useProxy: false

functions:
useDedicatedRunner: false
12 changes: 6 additions & 6 deletions .ci/helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,22 @@ function ci::test_pulsar_producer() {
}

function ci::wait_function_running() {
num_running=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bash -c 'bin/pulsar-admin functions status --tenant public --namespace test --name test-function | bin/jq .numRunning')
num_running=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bash -c 'bin/pulsar-admin functions status --tenant public --namespace test --name test-function | ./jq .numRunning')
while [[ ${num_running} -lt 1 ]]; do
echo ${num_running}
sleep 15
${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running
num_running=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bash -c 'bin/pulsar-admin functions status --tenant public --namespace test --name test-function | bin/jq .numRunning')
num_running=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bash -c 'bin/pulsar-admin functions status --tenant public --namespace test --name test-function | ./jq .numRunning')
done
}

function ci::wait_message_processed() {
num_processed=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bash -c 'bin/pulsar-admin functions stats --tenant public --namespace test --name test-function | bin/jq .processedSuccessfullyTotal')
num_processed=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bash -c 'bin/pulsar-admin functions stats --tenant public --namespace test --name test-function | ./jq .processedSuccessfullyTotal')
while [[ ${num_processed} -lt 1 ]]; do
echo ${num_processed}
sleep 15
${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bin/pulsar-admin functions stats --tenant public --namespace test --name test-function
num_processed=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bash -c 'bin/pulsar-admin functions stats --tenant public --namespace test --name test-function | bin/jq .processedSuccessfullyTotal')
num_processed=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bash -c 'bin/pulsar-admin functions stats --tenant public --namespace test --name test-function | ./jq .processedSuccessfullyTotal')
done
}

Expand All @@ -156,8 +156,8 @@ function ci::test_pulsar_function() {
${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-bookie-0 -- df -h
${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bin/bookkeeper shell listbookies -rw
${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bin/bookkeeper shell listbookies -ro
${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- curl --retry 10 -L -o bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- chmod +x bin/jq
${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- curl --retry 10 -L -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- chmod +x jq
${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-toolset-0 -- bin/pulsar-admin functions create --tenant public --namespace test --name test-function --inputs "public/test/test_input" --output "public/test/test_output" --parallelism 1 --classname org.apache.pulsar.functions.api.examples.ExclamationFunction --jar /pulsar/examples/api-examples.jar

# wait until the function is running
Expand Down
5 changes: 5 additions & 0 deletions charts/pulsar/templates/zookeeper/zookeeper-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ data:
PULSAR_PREFIX_dataLogDir: /pulsar/data/zookeeper-datalog
{{- end }}
{{- if .Values.zookeeper.useNettyIO }}
{{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
PULSAR_PREFIX_serverCnxnFactory: org.apache.zookeeper.server.NettyServerCnxnFactory
serverCnxnFactory: org.apache.zookeeper.server.NettyServerCnxnFactory
{{- else }}
PULSAR_PREFIX_serverCnxnFactory: org.apache.zookeeper.server.NIOServerCnxnFactory
serverCnxnFactory: org.apache.zookeeper.server.NIOServerCnxnFactory
{{- end }}
{{- end }}
# enable zookeeper tls
{{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
secureClientPort: "{{ .Values.zookeeper.ports.clientTls }}"
Expand Down

0 comments on commit beee2e6

Please sign in to comment.