From f54bf48bd3018b3a89cbf7f4b615ba37d1be2b10 Mon Sep 17 00:00:00 2001 From: laminar Date: Sat, 2 Jul 2022 10:50:54 +0800 Subject: [PATCH 01/17] replace `sleep` with `kubectl wait` Signed-off-by: laminar --- .ci/helm.sh | 65 ++++++++++--------- .ci/verify_function_mesh.sh | 2 - .../test-integration-kind-samples.yml | 23 +++---- 3 files changed, 47 insertions(+), 43 deletions(-) diff --git a/.ci/helm.sh b/.ci/helm.sh index 739ba868a..7224bffed 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -122,20 +122,29 @@ function ci::test_pulsar_producer() { function ci::verify_function_mesh() { FUNCTION_NAME=$1 - WC=$(${KUBECTL} get pods -lname=${FUNCTION_NAME} --field-selector=status.phase=Running | wc -l) - while [[ ${WC} -lt 1 ]]; do - echo ${WC}; - sleep 15 - ${KUBECTL} get pods -A - WC=$(${KUBECTL} get pods -lname=${FUNCTION_NAME} | wc -l) - if [[ ${WC} -gt 1 ]]; then - ${KUBECTL} describe pod -lname=${FUNCTION_NAME} - fi - WC=$(${KUBECTL} get pods -lname=${FUNCTION_NAME} --field-selector=status.phase=Running | wc -l) + + while true; do + num=$(${KUBECTL} get pods -lname="${FUNCTION_NAME}" | wc -l) + if [ "$num" -gt 1 ]; then + break + else + ${KUBECTL} get pods -A + sleep 2s + fi done - ${KUBECTL} describe pod -lname=${FUNCTION_NAME} - sleep 30 - ${KUBECTL} logs -lname=${FUNCTION_NAME} --all-containers=true + + ${KUBECTL} wait -lname="${FUNCTION_NAME}" --for=condition=Ready pod --timeout=5m && true + if [ $? -eq 0 ]; then + while true; do + num=$(${KUBECTL} logs -lname="${FUNCTION_NAME}" --all-containers=true --tail=-1 | grep "Created producer\|Created consumer" | wc -l) + if [ "$num" -gt 0 ]; then + break + else + ${KUBECTL} logs -lname="${FUNCTION_NAME}" --all-containers=true --tail=-1 || true + sleep 5s + fi + done + fi } function ci::verify_hpa() { @@ -211,10 +220,6 @@ function ci::verify_go_function() { } function ci::verify_java_function() { - FUNCTION_NAME=$1 - ${KUBECTL} describe pod -lname=${FUNCTION_NAME} - sleep 120 - ${KUBECTL} logs -lname=${FUNCTION_NAME} --all-containers=true ci:verify_exclamation_function "persistent://public/default/input-java-topic" "persistent://public/default/output-java-topic" "test-message" "test-message!" 30 } @@ -237,17 +242,17 @@ function ci::print_function_log() { } function ci:verify_exclamation_function() { - inputtopic=$1 - outputtopic=$2 - inputmessage=$3 - outputmessage=$4 - timesleep=$5 - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m ${inputmessage} -n 1 ${inputtopic} - sleep $timesleep - MESSAGE=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "sub" --subscription-position Earliest ${outputtopic}) - echo $MESSAGE - if [[ "$MESSAGE" == *"$outputmessage"* ]]; then - return 0 - fi - return 1 + inputtopic=$1 + outputtopic=$2 + inputmessage=$3 + outputmessage=$4 + timesleep=$5 + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "${inputmessage}" -n 1 "${inputtopic}" + sleep "$timesleep" + MESSAGE=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "sub" --subscription-position Earliest "${outputtopic}") + echo "$MESSAGE" + if [[ "$MESSAGE" == *"$outputmessage"* ]]; then + return 0 + fi + return 1 } diff --git a/.ci/verify_function_mesh.sh b/.ci/verify_function_mesh.sh index f022b8d7f..e4d6d36f2 100755 --- a/.ci/verify_function_mesh.sh +++ b/.ci/verify_function_mesh.sh @@ -37,8 +37,6 @@ case ${1} in ;; compute_v1alpha1_function) ci::verify_function_mesh function-sample - sleep 60 - ci::print_function_log function-sample ci::verify_java_function function-sample ;; compute_v1alpha1_py_function) diff --git a/.github/workflows/test-integration-kind-samples.yml b/.github/workflows/test-integration-kind-samples.yml index f8564241d..36131560e 100644 --- a/.github/workflows/test-integration-kind-samples.yml +++ b/.github/workflows/test-integration-kind-samples.yml @@ -65,21 +65,22 @@ jobs: # operator-sdk create api --group compute --version v1alpha1 --kind Function --resource=true --controller=true # operator-sdk create webhook --group compute.functionmesh.io --version v1alpha1 --kind Function --defaulting --programmatic-validation - - name: Deploy function mesh server + - name: Build and load function-mesh operator image run: | make generate - make install - make docker-build-skip-test - IMG=$(make function-mesh-docker-image-name) + make helm-crds + image="function-mesh-operator:latest" + IMG=${image} make docker-build-skip-test clusters=$(kind get clusters) - echo $clusters - for cluster in $clusters - do - kind load docker-image --name ${cluster} ${IMG} + for cluster in $clusters; do + kind load docker-image --name ${cluster} ${image} done - make deploy - kubectl get crds - kubectl wait --for condition=ready --timeout=360s pod -l app=function-mesh-operator,control-plane=controller-manager + + - name: Deploy function mesh server + run: | + helm install function-mesh -n function-mesh --set operatorImage=function-mesh-operator:latest --create-namespace charts/function-mesh-operator + kubectl wait --for=condition=Ready -l app.kubernetes.io/name=function-mesh-operator pods -n function-mesh --timeout=5m + kubectl get pods -n function-mesh - name: Test Function kind - Java Function run: | From 4a3d1d7973af943157d60f24105793075c64e3f5 Mon Sep 17 00:00:00 2001 From: laminar Date: Sat, 2 Jul 2022 20:57:24 +0800 Subject: [PATCH 02/17] Updates for golang function,python function,functionmesh Signed-off-by: laminar --- .ci/helm.sh | 6 ------ .ci/verify_function_mesh.sh | 14 +++----------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/.ci/helm.sh b/.ci/helm.sh index 7224bffed..d2585f2bb 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -213,9 +213,6 @@ function ci::test_function_runners() { } function ci::verify_go_function() { - FUNCTION_NAME=$1 - ${KUBECTL} describe pod -lname=${FUNCTION_NAME} - ${KUBECTL} logs -lname=${FUNCTION_NAME} --all-containers=true ci:verify_exclamation_function "persistent://public/default/input-go-topic" "persistent://public/default/output-go-topic" "test-message" "test-message!" 30 } @@ -224,9 +221,6 @@ function ci::verify_java_function() { } function ci::verify_python_function() { - FUNCTION_NAME=$1 - ${KUBECTL} describe pod -lname=${FUNCTION_NAME} - ${KUBECTL} logs -lname=${FUNCTION_NAME} --all-containers=true ci:verify_exclamation_function "persistent://public/default/input-python-topic" "persistent://public/default/output-python-topic" "test-message" "test-message!" 30 } diff --git a/.ci/verify_function_mesh.sh b/.ci/verify_function_mesh.sh index e4d6d36f2..9876b163e 100755 --- a/.ci/verify_function_mesh.sh +++ b/.ci/verify_function_mesh.sh @@ -31,28 +31,20 @@ source ${PULSAR_HOME}/.ci/helm.sh case ${1} in compute_v1alpha1_go_function) ci::verify_function_mesh go-function-sample - sleep 60 - ci::print_function_log go-function-sample - ci::verify_go_function go-function-sample + ci::verify_go_function ;; compute_v1alpha1_function) ci::verify_function_mesh function-sample - ci::verify_java_function function-sample + ci::verify_java_function ;; compute_v1alpha1_py_function) ci::verify_function_mesh py-function-sample - sleep 60 - ci::print_function_log py-function-sample - ci::verify_python_function py-function-sample + ci::verify_python_function ;; compute_v1alpha1_functionmesh) ci::verify_function_mesh functionmesh-sample-java-function ci::verify_function_mesh functionmesh-sample-golang-function ci::verify_function_mesh functionmesh-sample-python-function - sleep 60 - ci::print_function_log functionmesh-sample-java-function - ci::print_function_log functionmesh-sample-golang-function - ci::print_function_log functionmesh-sample-python-function ci::verify_mesh_function ;; compute_v1alpha1_function_hpa) From c55848a5efc5bc29ca466cadf99ae546676d6a24 Mon Sep 17 00:00:00 2001 From: laminar Date: Sat, 2 Jul 2022 21:12:20 +0800 Subject: [PATCH 03/17] updates for hpa (builtin) function, statefulset function Signed-off-by: laminar --- .ci/verify_function_mesh.sh | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.ci/verify_function_mesh.sh b/.ci/verify_function_mesh.sh index 9876b163e..e82ffa46e 100755 --- a/.ci/verify_function_mesh.sh +++ b/.ci/verify_function_mesh.sh @@ -50,25 +50,17 @@ case ${1} in compute_v1alpha1_function_hpa) ci::verify_function_mesh function-hpa-sample ci::verify_hpa function-hpa-sample - sleep 60 - ci::print_function_log function-hpa-sample - ci::verify_java_function function-hpa-sample + ci::verify_java_function ci::verify_hpa function-hpa-sample ;; compute_v1alpha1_function_builtin_hpa) ci::verify_function_mesh function-builtin-hpa-sample ci::verify_hpa function-builtin-hpa-sample - sleep 60 - ci::print_function_log function-builtin-hpa-sample - ci::verify_java_function function-builtin-hpa-sample + ci::verify_java_function ci::verify_hpa function-builtin-hpa-sample ;; compute_v1alpha1_function_stateful) ci::verify_function_mesh java-function-stateful-sample - sleep 60 - ci::print_function_log java-function-stateful-sample - ci::verify_java_function java-function-stateful-sample - sleep 60 - ci::print_function_log java-function-stateful-sample + ci::verify_java_function ;; esac \ No newline at end of file From 9d385704e64242b6ca101fba884500b32d8fdb0c Mon Sep 17 00:00:00 2001 From: laminar Date: Sat, 2 Jul 2022 21:14:18 +0800 Subject: [PATCH 04/17] update bk svc url Signed-off-by: laminar --- .ci/clusters/compute_v1alpha1_function_stateful.yaml | 2 +- config/samples/compute_v1alpha1_function_stateful.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/clusters/compute_v1alpha1_function_stateful.yaml b/.ci/clusters/compute_v1alpha1_function_stateful.yaml index 6bd0b1aaa..9adc141d5 100644 --- a/.ci/clusters/compute_v1alpha1_function_stateful.yaml +++ b/.ci/clusters/compute_v1alpha1_function_stateful.yaml @@ -33,7 +33,7 @@ spec: autoAck: true statefulConfig: pulsar: - serviceUrl: "bk://sn-platform-pulsar-bk.default.svc.cluster.local:4181" + serviceUrl: "bk://sn-platform-pulsar-bookie.default.svc.cluster.local:4181" --- apiVersion: v1 kind: ConfigMap diff --git a/config/samples/compute_v1alpha1_function_stateful.yaml b/config/samples/compute_v1alpha1_function_stateful.yaml index 3f0897fd6..8fc639e62 100644 --- a/config/samples/compute_v1alpha1_function_stateful.yaml +++ b/config/samples/compute_v1alpha1_function_stateful.yaml @@ -34,7 +34,7 @@ spec: autoAck: true statefulConfig: pulsar: - serviceUrl: "bk://test-pulsar-bk.default.svc.cluster.local:4181" + serviceUrl: "bk://test-pulsar-bookie.default.svc.cluster.local:4181" --- apiVersion: v1 kind: ConfigMap From 58edc4c3a2967af028fc69ece58fd47866d31f15 Mon Sep 17 00:00:00 2001 From: laminar Date: Sat, 2 Jul 2022 22:53:21 +0800 Subject: [PATCH 05/17] update test_pulsar_producer and comment stateful function test Signed-off-by: laminar --- .ci/helm.sh | 22 +++++++++++-------- .../test-integration-kind-samples.yml | 18 +++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.ci/helm.sh b/.ci/helm.sh index d2585f2bb..ab5ba3613 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -111,13 +111,17 @@ function ci::install_pulsar_charts() { } function ci::test_pulsar_producer() { - sleep 120 - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin namespaces create sn-platform/test - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "test-message" sn-platform/test/test-topic + ${KUBECTL} wait -n ${NAMESPACE} -l app=pulsar --for=condition=Ready pod --timeout=2m && true + if [ $? -eq 0 ]; then + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin namespaces create sn-platform/test + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "test-message" sn-platform/test/test-topic + else + ${KUBECTL} get pods -n ${NAMESPACE} -l app=pulsar && false + fi } function ci::verify_function_mesh() { @@ -133,7 +137,7 @@ function ci::verify_function_mesh() { fi done - ${KUBECTL} wait -lname="${FUNCTION_NAME}" --for=condition=Ready pod --timeout=5m && true + ${KUBECTL} wait -lname="${FUNCTION_NAME}" --for=condition=Ready pod --timeout=2m && true if [ $? -eq 0 ]; then while true; do num=$(${KUBECTL} logs -lname="${FUNCTION_NAME}" --all-containers=true --tail=-1 | grep "Created producer\|Created consumer" | wc -l) @@ -225,7 +229,7 @@ function ci::verify_python_function() { } function ci::verify_mesh_function() { - ci:verify_exclamation_function "persistent://public/default/functionmesh-input-topic" "persistent://public/default/functionmesh-python-topic" "test-message" "test-message!!!" 120 + ci:verify_exclamation_function "persistent://public/default/functionmesh-input-topic" "persistent://public/default/functionmesh-python-topic" "test-message" "test-message!!!" 30 } function ci::print_function_log() { diff --git a/.github/workflows/test-integration-kind-samples.yml b/.github/workflows/test-integration-kind-samples.yml index 36131560e..485f0eac0 100644 --- a/.github/workflows/test-integration-kind-samples.yml +++ b/.github/workflows/test-integration-kind-samples.yml @@ -142,15 +142,15 @@ jobs: .ci/verify_function_mesh.sh compute_v1alpha1_function_builtin_hpa kubectl delete -f .ci/clusters/compute_v1alpha1_function_builtin_hpa.yaml - - name: Test Java Stateful Function - run: | - kubectl apply -f .ci/clusters/compute_v1alpha1_function_stateful.yaml - kubectl get all - - - name: Verify Java Stateful Function - run: | - .ci/verify_function_mesh.sh compute_v1alpha1_function_stateful - kubectl delete -f .ci/clusters/compute_v1alpha1_function_stateful.yaml +# - name: Test Java Stateful Function +# run: | +# kubectl apply -f .ci/clusters/compute_v1alpha1_function_stateful.yaml +# kubectl get all +# +# - name: Verify Java Stateful Function +# run: | +# .ci/verify_function_mesh.sh compute_v1alpha1_function_stateful +# kubectl delete -f .ci/clusters/compute_v1alpha1_function_stateful.yaml - name: Setup tmate session uses: mxschmitt/action-tmate@v3 From 858bc8d5cb548bb45bb725cdd7e436bab84ec4dd Mon Sep 17 00:00:00 2001 From: laminar Date: Mon, 4 Jul 2022 14:18:32 +0800 Subject: [PATCH 06/17] rollback test_pulsar_producer Signed-off-by: laminar --- .ci/helm.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.ci/helm.sh b/.ci/helm.sh index ab5ba3613..80664d69c 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -111,17 +111,13 @@ function ci::install_pulsar_charts() { } function ci::test_pulsar_producer() { - ${KUBECTL} wait -n ${NAMESPACE} -l app=pulsar --for=condition=Ready pod --timeout=2m && true - if [ $? -eq 0 ]; then - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin namespaces create sn-platform/test - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "test-message" sn-platform/test/test-topic - else - ${KUBECTL} get pods -n ${NAMESPACE} -l app=pulsar && false - fi + sleep 120 + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin namespaces create sn-platform/test + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "test-message" sn-platform/test/test-topic } function ci::verify_function_mesh() { From 2df44c2571a0df07d5e6f42a5c0cb6d375d53351 Mon Sep 17 00:00:00 2001 From: laminar Date: Mon, 4 Jul 2022 14:37:41 +0800 Subject: [PATCH 07/17] add presto image repository config Signed-off-by: laminar --- .ci/clusters/values.yaml | 4 ++++ .ci/clusters/values_runner_images.yaml | 4 ++++ .ci/helm.sh | 18 +++++++++++------- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.ci/clusters/values.yaml b/.ci/clusters/values.yaml index 2b4bcad7c..e2dbb7928 100644 --- a/.ci/clusters/values.yaml +++ b/.ci/clusters/values.yaml @@ -58,6 +58,10 @@ images: proxy: repository: streamnative/pulsar-all tag: 2.10.0.0-rc10 + presto: + repository: streamnative/pulsar-all + tag: 2.10.0.0-rc10 + pullPolicy: IfNotPresent zookeeper: replicaCount: 1 diff --git a/.ci/clusters/values_runner_images.yaml b/.ci/clusters/values_runner_images.yaml index ae643c6a7..ebc384cec 100644 --- a/.ci/clusters/values_runner_images.yaml +++ b/.ci/clusters/values_runner_images.yaml @@ -62,6 +62,10 @@ images: repository: streamnative/pulsar-all tag: 2.10.0.0-rc10 pullPolicy: IfNotPresent + presto: + repository: streamnative/pulsar-all + tag: 2.10.0.0-rc10 + pullPolicy: IfNotPresent zookeeper: replicaCount: 1 diff --git a/.ci/helm.sh b/.ci/helm.sh index 80664d69c..ab5ba3613 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -111,13 +111,17 @@ function ci::install_pulsar_charts() { } function ci::test_pulsar_producer() { - sleep 120 - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin namespaces create sn-platform/test - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "test-message" sn-platform/test/test-topic + ${KUBECTL} wait -n ${NAMESPACE} -l app=pulsar --for=condition=Ready pod --timeout=2m && true + if [ $? -eq 0 ]; then + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin namespaces create sn-platform/test + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "test-message" sn-platform/test/test-topic + else + ${KUBECTL} get pods -n ${NAMESPACE} -l app=pulsar && false + fi } function ci::verify_function_mesh() { From 9342929136eb93b6ad177ffdf467c7d50e05d186 Mon Sep 17 00:00:00 2001 From: laminar Date: Mon, 4 Jul 2022 15:36:23 +0800 Subject: [PATCH 08/17] rollback test_pulsar_producer Signed-off-by: laminar --- .ci/clusters/values.yaml | 1 - .ci/helm.sh | 18 +++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.ci/clusters/values.yaml b/.ci/clusters/values.yaml index e2dbb7928..dffd79f1e 100644 --- a/.ci/clusters/values.yaml +++ b/.ci/clusters/values.yaml @@ -61,7 +61,6 @@ images: presto: repository: streamnative/pulsar-all tag: 2.10.0.0-rc10 - pullPolicy: IfNotPresent zookeeper: replicaCount: 1 diff --git a/.ci/helm.sh b/.ci/helm.sh index ab5ba3613..80664d69c 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -111,17 +111,13 @@ function ci::install_pulsar_charts() { } function ci::test_pulsar_producer() { - ${KUBECTL} wait -n ${NAMESPACE} -l app=pulsar --for=condition=Ready pod --timeout=2m && true - if [ $? -eq 0 ]; then - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin namespaces create sn-platform/test - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "test-message" sn-platform/test/test-topic - else - ${KUBECTL} get pods -n ${NAMESPACE} -l app=pulsar && false - fi + sleep 120 + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin namespaces create sn-platform/test + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "test-message" sn-platform/test/test-topic } function ci::verify_function_mesh() { From dd405130ac70657c23e9e169a8a12328468fd3e4 Mon Sep 17 00:00:00 2001 From: laminar Date: Tue, 5 Jul 2022 13:15:03 +0800 Subject: [PATCH 09/17] refine the stateful function test case - downgrade the streamnative/pulsar-all image from 2.10.0.0-rc0 to 2.9.2.23 - add configuration items to bk to enable the stream storage server Signed-off-by: laminar --- .ci/clusters/compute_v1alpha1_function.yaml | 2 +- ...compute_v1alpha1_function_builtin_hpa.yaml | 2 +- .../compute_v1alpha1_function_hpa.yaml | 2 +- .../compute_v1alpha1_function_stateful.yaml | 17 ++++----- .../compute_v1alpha1_functionmesh.yaml | 6 ++-- .../compute_v1alpha1_go_function.yaml | 2 +- .../compute_v1alpha1_py_function.yaml | 2 +- .ci/clusters/values.yaml | 26 +++++++++----- .ci/helm.sh | 36 +++++++++++++++---- .ci/verify_function_mesh.sh | 6 ++-- .../test-integration-kind-samples.yml | 22 ++++++------ 11 files changed, 78 insertions(+), 45 deletions(-) diff --git a/.ci/clusters/compute_v1alpha1_function.yaml b/.ci/clusters/compute_v1alpha1_function.yaml index 47ab75c62..017a274aa 100644 --- a/.ci/clusters/compute_v1alpha1_function.yaml +++ b/.ci/clusters/compute_v1alpha1_function.yaml @@ -4,7 +4,7 @@ metadata: name: function-sample namespace: default spec: - image: streamnative/pulsar-functions-java-sample:2.10.0.0-rc10 + image: streamnative/pulsar-functions-java-sample:2.9.2.23 className: org.apache.pulsar.functions.api.examples.ExclamationFunction forwardSourceMessageProperty: true maxPendingAsyncRequests: 1000 diff --git a/.ci/clusters/compute_v1alpha1_function_builtin_hpa.yaml b/.ci/clusters/compute_v1alpha1_function_builtin_hpa.yaml index 61d52cbed..d9bbaf8c9 100644 --- a/.ci/clusters/compute_v1alpha1_function_builtin_hpa.yaml +++ b/.ci/clusters/compute_v1alpha1_function_builtin_hpa.yaml @@ -4,7 +4,7 @@ metadata: name: function-builtin-hpa-sample namespace: default spec: - image: streamnative/pulsar-functions-java-sample:2.10.0.0-rc10 + image: streamnative/pulsar-functions-java-sample:2.9.2.23 className: org.apache.pulsar.functions.api.examples.ExclamationFunction forwardSourceMessageProperty: true maxPendingAsyncRequests: 1000 diff --git a/.ci/clusters/compute_v1alpha1_function_hpa.yaml b/.ci/clusters/compute_v1alpha1_function_hpa.yaml index 6d9a70c5c..3a0dc0ffe 100644 --- a/.ci/clusters/compute_v1alpha1_function_hpa.yaml +++ b/.ci/clusters/compute_v1alpha1_function_hpa.yaml @@ -4,7 +4,7 @@ metadata: name: function-hpa-sample namespace: default spec: - image: streamnative/pulsar-functions-java-sample:2.10.0.0-rc10 + image: streamnative/pulsar-functions-java-sample:2.9.2.23 className: org.apache.pulsar.functions.api.examples.ExclamationFunction forwardSourceMessageProperty: true maxPendingAsyncRequests: 1000 diff --git a/.ci/clusters/compute_v1alpha1_function_stateful.yaml b/.ci/clusters/compute_v1alpha1_function_stateful.yaml index 9adc141d5..99ec81c6b 100644 --- a/.ci/clusters/compute_v1alpha1_function_stateful.yaml +++ b/.ci/clusters/compute_v1alpha1_function_stateful.yaml @@ -1,22 +1,22 @@ apiVersion: compute.functionmesh.io/v1alpha1 kind: Function metadata: - name: java-function-stateful-sample + name: python-function-stateful-sample namespace: default spec: - image: streamnative/pulsar-functions-java-sample:2.10.0.0-rc10 - className: org.apache.pulsar.functions.api.examples.WordCountFunction + image: streamnative/pulsar-functions-python-sample:2.9.2.23 + className: wordcount_function.WordCountFunction forwardSourceMessageProperty: true maxPendingAsyncRequests: 1000 replicas: 1 maxReplicas: 5 - logTopic: persistent://public/default/logging-function-logs + logTopic: persistent://public/default/logging-stateful-function-logs input: topics: - - persistent://public/default/java-function-stateful-input-topic + - persistent://public/default/python-function-stateful-input-topic typeClassName: java.lang.String output: - topic: persistent://public/default/java-function-stateful-output-topic + topic: persistent://public/default/python-function-stateful-output-topic typeClassName: java.lang.String resources: requests: @@ -27,8 +27,9 @@ spec: memory: 1.1G pulsar: pulsarConfig: "test-pulsar" - java: - jar: /pulsar/examples/api-examples.jar + python: + py: /pulsar/examples/python-examples/wordcount_function.py + pyLocation: "" clusterName: test-pulsar autoAck: true statefulConfig: diff --git a/.ci/clusters/compute_v1alpha1_functionmesh.yaml b/.ci/clusters/compute_v1alpha1_functionmesh.yaml index 831dfce43..bf6f4e6a9 100644 --- a/.ci/clusters/compute_v1alpha1_functionmesh.yaml +++ b/.ci/clusters/compute_v1alpha1_functionmesh.yaml @@ -5,7 +5,7 @@ metadata: spec: functions: - name: java-function - image: streamnative/pulsar-functions-java-sample:2.10.0.0-rc10 + image: streamnative/pulsar-functions-java-sample:2.9.2.23 className: org.apache.pulsar.functions.api.examples.ExclamationFunction replicas: 1 maxReplicas: 1 @@ -31,7 +31,7 @@ spec: memory: 1.1G clusterName: test - name: golang-function - image: streamnative/pulsar-functions-go-sample:2.10.0.0-rc10 + image: streamnative/pulsar-functions-go-sample:2.9.2.23 replicas: 1 maxReplicas: 1 input: @@ -56,7 +56,7 @@ spec: memory: 1.1G clusterName: test - name: python-function - image: streamnative/pulsar-functions-python-sample:2.10.0.0-rc10 + image: streamnative/pulsar-functions-python-sample:2.9.2.23 className: exclamation_function.ExclamationFunction replicas: 1 maxReplicas: 1 diff --git a/.ci/clusters/compute_v1alpha1_go_function.yaml b/.ci/clusters/compute_v1alpha1_go_function.yaml index 4de3f2196..e478063e9 100644 --- a/.ci/clusters/compute_v1alpha1_go_function.yaml +++ b/.ci/clusters/compute_v1alpha1_go_function.yaml @@ -4,7 +4,7 @@ metadata: name: go-function-sample namespace: default spec: - image: streamnative/pulsar-functions-go-sample:2.10.0.0-rc10 + image: streamnative/pulsar-functions-go-sample:2.9.2.23 forwardSourceMessageProperty: true maxPendingAsyncRequests: 1000 replicas: 1 diff --git a/.ci/clusters/compute_v1alpha1_py_function.yaml b/.ci/clusters/compute_v1alpha1_py_function.yaml index 10f92a5a4..0b09db339 100644 --- a/.ci/clusters/compute_v1alpha1_py_function.yaml +++ b/.ci/clusters/compute_v1alpha1_py_function.yaml @@ -4,7 +4,7 @@ metadata: name: py-function-sample namespace: default spec: - image: streamnative/pulsar-functions-python-sample:2.10.0.0-rc10 + image: streamnative/pulsar-functions-python-sample:2.9.2.23 className: exclamation_function.ExclamationFunction forwardSourceMessageProperty: true maxPendingAsyncRequests: 1000 diff --git a/.ci/clusters/values.yaml b/.ci/clusters/values.yaml index dffd79f1e..e55000b37 100644 --- a/.ci/clusters/values.yaml +++ b/.ci/clusters/values.yaml @@ -29,6 +29,7 @@ affinity: components: autorecovery: false pulsar_manager: false + sql_worker: false ## disable monitoring stack monitoring: @@ -42,25 +43,25 @@ monitoring: images: zookeeper: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 bookie: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 autorecovery: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 broker: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 functions: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 proxy: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 presto: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 zookeeper: replicaCount: 1 @@ -70,8 +71,15 @@ bookkeeper: metadata: image: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 configData: + PULSAR_PREFIX_autoRecoveryDaemonEnabled: "false" + PULSAR_PREFIX_dlog.bkcEnsembleSize: "1" + PULSAR_PREFIX_dlog.bkcWriteQuorumSize: "1" + PULSAR_PREFIX_dlog.bkcAckQuorumSize: "1" + PULSAR_PREFIX_storage.range.store.dirs: "/pulsar/data/bookkeeper/ranges" + PULSAR_PREFIX_storage.serve.readonly.tables: "false" + PULSAR_PREFIX_storageserver.grpc.port: "4181" # `BOOKIE_MEM` is used for `bookie shell` BOOKIE_MEM: > -Xms128m @@ -100,7 +108,7 @@ bookkeeper: pulsar_metadata: image: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 broker: replicaCount: 1 diff --git a/.ci/helm.sh b/.ci/helm.sh index 80664d69c..9464c5bb8 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -112,12 +112,15 @@ function ci::install_pulsar_charts() { function ci::test_pulsar_producer() { sleep 120 + # broker ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin namespaces create sn-platform/test ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "test-message" sn-platform/test/test-topic + # bookkeeper + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- df -h + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- cat conf/bookkeeper.conf + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 -- nc -zv 127.0.0.1 4181 } function ci::verify_function_mesh() { @@ -213,19 +216,23 @@ function ci::test_function_runners() { } function ci::verify_go_function() { - ci:verify_exclamation_function "persistent://public/default/input-go-topic" "persistent://public/default/output-go-topic" "test-message" "test-message!" 30 + ci:verify_exclamation_function "persistent://public/default/input-go-topic" "persistent://public/default/output-go-topic" "test-message" "test-message!" 10 } function ci::verify_java_function() { - ci:verify_exclamation_function "persistent://public/default/input-java-topic" "persistent://public/default/output-java-topic" "test-message" "test-message!" 30 + ci:verify_exclamation_function "persistent://public/default/input-java-topic" "persistent://public/default/output-java-topic" "test-message" "test-message!" 10 } function ci::verify_python_function() { - ci:verify_exclamation_function "persistent://public/default/input-python-topic" "persistent://public/default/output-python-topic" "test-message" "test-message!" 30 + ci:verify_exclamation_function "persistent://public/default/input-python-topic" "persistent://public/default/output-python-topic" "test-message" "test-message!" 10 +} + +function ci::verify_stateful_function() { + ci:verify_wordcount_function "persistent://public/default/python-function-stateful-input-topic" "persistent://public/default/logging-stateful-function-logs" "apple apple apple" "The value is 3" 10 } function ci::verify_mesh_function() { - ci:verify_exclamation_function "persistent://public/default/functionmesh-input-topic" "persistent://public/default/functionmesh-python-topic" "test-message" "test-message!!!" 30 + ci:verify_exclamation_function "persistent://public/default/functionmesh-input-topic" "persistent://public/default/functionmesh-python-topic" "test-message" "test-message!!!" 10 } function ci::print_function_log() { @@ -250,3 +257,20 @@ function ci:verify_exclamation_function() { fi return 1 } + +function ci:verify_wordcount_function() { + inputtopic=$1 + outputtopic=$2 + inputmessage=$3 + outputmessage=$4 + timesleep=$5 + ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "${inputmessage}" -n 1 "${inputtopic}" + sleep "$timesleep" + MESSAGE=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 3 -s "sub" --subscription-position Earliest "${outputtopic}") + echo "$MESSAGE" + if [[ "$MESSAGE" == *"$outputmessage"* ]]; then + return 0 + fi + return 1 +} + diff --git a/.ci/verify_function_mesh.sh b/.ci/verify_function_mesh.sh index e82ffa46e..0abfb787d 100755 --- a/.ci/verify_function_mesh.sh +++ b/.ci/verify_function_mesh.sh @@ -60,7 +60,7 @@ case ${1} in ci::verify_hpa function-builtin-hpa-sample ;; compute_v1alpha1_function_stateful) - ci::verify_function_mesh java-function-stateful-sample - ci::verify_java_function + ci::verify_function_mesh python-function-stateful-sample + ci::verify_stateful_function ;; -esac \ No newline at end of file +esac diff --git a/.github/workflows/test-integration-kind-samples.yml b/.github/workflows/test-integration-kind-samples.yml index 485f0eac0..a9d989ca8 100644 --- a/.github/workflows/test-integration-kind-samples.yml +++ b/.github/workflows/test-integration-kind-samples.yml @@ -46,8 +46,8 @@ jobs: - name: Build runner images run: | - PULSAR_IMAGE_TAG=2.10.0.0-rc10 PULSAR_IMAGE=streamnative/pulsar-all KIND_PUSH=true images/build.sh - PULSAR_IMAGE_TAG=2.10.0.0-rc10 KIND_PUSH=true images/samples/build.sh + PULSAR_IMAGE_TAG=2.9.2.23 PULSAR_IMAGE=streamnative/pulsar-all KIND_PUSH=true images/build.sh + PULSAR_IMAGE_TAG=2.9.2.23 KIND_PUSH=true images/samples/build.sh - name: Install operator-sdk run: | @@ -142,15 +142,15 @@ jobs: .ci/verify_function_mesh.sh compute_v1alpha1_function_builtin_hpa kubectl delete -f .ci/clusters/compute_v1alpha1_function_builtin_hpa.yaml -# - name: Test Java Stateful Function -# run: | -# kubectl apply -f .ci/clusters/compute_v1alpha1_function_stateful.yaml -# kubectl get all -# -# - name: Verify Java Stateful Function -# run: | -# .ci/verify_function_mesh.sh compute_v1alpha1_function_stateful -# kubectl delete -f .ci/clusters/compute_v1alpha1_function_stateful.yaml + - name: Test Python Stateful Function + run: | + kubectl apply -f .ci/clusters/compute_v1alpha1_function_stateful.yaml + kubectl get all + + - name: Verify Python Stateful Function + run: | + .ci/verify_function_mesh.sh compute_v1alpha1_function_stateful + kubectl delete -f .ci/clusters/compute_v1alpha1_function_stateful.yaml - name: Setup tmate session uses: mxschmitt/action-tmate@v3 From dd96749d3cd8aab8d46d1422c75209ca5ec1fa76 Mon Sep 17 00:00:00 2001 From: laminar Date: Wed, 6 Jul 2022 19:56:46 +0800 Subject: [PATCH 10/17] fix runner tests Signed-off-by: laminar --- .ci/clusters/values_custom_runner_images.yaml | 30 ++++++++----- .ci/clusters/values_runner_images.yaml | 32 ++++++++------ .ci/helm.sh | 5 ++- .github/workflows/test-e2e-crypto.yml | 3 +- .github/workflows/test-function-runner.yml | 2 +- .../test-integration-kind-samples.yml | 42 +++++++++++++++++++ .github/workflows/test-sink.yml | 1 + .github/workflows/test-source.yml | 1 + 8 files changed, 90 insertions(+), 26 deletions(-) diff --git a/.ci/clusters/values_custom_runner_images.yaml b/.ci/clusters/values_custom_runner_images.yaml index 59abc0124..d43f64010 100644 --- a/.ci/clusters/values_custom_runner_images.yaml +++ b/.ci/clusters/values_custom_runner_images.yaml @@ -41,27 +41,27 @@ monitoring: images: zookeeper: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent bookie: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent autorecovery: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent broker: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent proxy: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent functions: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent zookeeper: @@ -72,8 +72,15 @@ bookkeeper: metadata: image: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 configData: + PULSAR_PREFIX_autoRecoveryDaemonEnabled: "false" + PULSAR_PREFIX_dlog.bkcEnsembleSize: "1" + PULSAR_PREFIX_dlog.bkcWriteQuorumSize: "1" + PULSAR_PREFIX_dlog.bkcAckQuorumSize: "1" + PULSAR_PREFIX_storage.range.store.dirs: "/pulsar/data/bookkeeper/ranges" + PULSAR_PREFIX_storage.serve.readonly.tables: "false" + PULSAR_PREFIX_storageserver.grpc.port: "4181" # `BOOKIE_MEM` is used for `bookie shell` BOOKIE_MEM: > -Xms128m @@ -102,7 +109,7 @@ bookkeeper: pulsar_metadata: image: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent broker: @@ -117,6 +124,7 @@ broker: managedLedgerDefaultAckQuorum: "1" functions: + functionState: true component: functions-worker enableCustomizerRuntime: false runtimeCustomizerClassName: "org.apache.pulsar.functions.runtime.kubernetes.BasicKubernetesManifestCustomizer" @@ -148,9 +156,9 @@ functions: narExtractionDirectory: "" functionRuntimeFactoryConfigs: functionDockerImages: - JAVA: "streamnative/pulsar-functions-java-runner:2.10.0.0-rc10" - PYTHON: "streamnative/pulsar-functions-python-runner:2.10.0.0-rc10" - GO: "streamnative/pulsar-functions-go-runner:2.10.0.0-rc10" + JAVA: "streamnative/pulsar-functions-java-runner:2.9.2.23" + PYTHON: "streamnative/pulsar-functions-python-runner:2.9.2.23" + GO: "streamnative/pulsar-functions-go-runner:2.9.2.23" proxy: replicaCount: 1 diff --git a/.ci/clusters/values_runner_images.yaml b/.ci/clusters/values_runner_images.yaml index ebc384cec..ee327492a 100644 --- a/.ci/clusters/values_runner_images.yaml +++ b/.ci/clusters/values_runner_images.yaml @@ -40,31 +40,31 @@ monitoring: images: zookeeper: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent bookie: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent autorecovery: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent broker: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent proxy: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent functions: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent presto: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent zookeeper: @@ -75,8 +75,15 @@ bookkeeper: metadata: image: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 configData: + PULSAR_PREFIX_autoRecoveryDaemonEnabled: "false" + PULSAR_PREFIX_dlog.bkcEnsembleSize: "1" + PULSAR_PREFIX_dlog.bkcWriteQuorumSize: "1" + PULSAR_PREFIX_dlog.bkcAckQuorumSize: "1" + PULSAR_PREFIX_storage.range.store.dirs: "/pulsar/data/bookkeeper/ranges" + PULSAR_PREFIX_storage.serve.readonly.tables: "false" + PULSAR_PREFIX_storageserver.grpc.port: "4181" # `BOOKIE_MEM` is used for `bookie shell` BOOKIE_MEM: > -Xms128m @@ -105,7 +112,7 @@ bookkeeper: pulsar_metadata: image: repository: streamnative/pulsar-all - tag: 2.10.0.0-rc10 + tag: 2.9.2.23 pullPolicy: IfNotPresent broker: @@ -126,6 +133,7 @@ proxy: ## templates/function-worker-configmap.yaml ## functions: + functionState: true component: functions-worker enableCustomizerRuntime: false runtimeCustomizerClassName: "org.apache.pulsar.functions.runtime.kubernetes.BasicKubernetesManifestCustomizer" @@ -165,9 +173,9 @@ functions: disk: 1048576000 functionRuntimeFactoryConfigs: functionDockerImages: - JAVA: "streamnative/pulsar-functions-java-runner:2.10.0.0-rc10" - PYTHON: "streamnative/pulsar-functions-python-runner:2.10.0.0-rc10" - GO: "streamnative/pulsar-functions-go-runner:2.10.0.0-rc10" + JAVA: "streamnative/pulsar-functions-java-runner:2.9.2.23" + PYTHON: "streamnative/pulsar-functions-python-runner:2.9.2.23" + GO: "streamnative/pulsar-functions-go-runner:2.9.2.23" functionInstanceMinResources: cpu: 0.1 ram: 10485760 diff --git a/.ci/helm.sh b/.ci/helm.sh index 9464c5bb8..4bb9a4435 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -91,7 +91,7 @@ function ci::install_pulsar_charts() { cd charts helm repo add loki https://grafana.github.io/loki/charts helm dependency update pulsar - ${HELM} install sn-platform --values ./pulsar/mini_values.yaml ./pulsar --debug + ${HELM} install sn-platform --set initialize=true --values ./pulsar/mini_values.yaml ./pulsar --debug echo "wait until broker is alive" WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep ${CLUSTER}-pulsar-broker | wc -l) @@ -99,6 +99,9 @@ function ci::install_pulsar_charts() { echo ${WC}; sleep 20 ${KUBECTL} get pods -n ${NAMESPACE} + for po in $(${KUBECTL} get pods -l app=pulsar --no-headers | grep -v "Running" | awk '{ print 1 }'); do + ${KUBECTL} logs "$po" --all-containers=true --tail=50 + done WC=$(${KUBECTL} get pods -n ${NAMESPACE} | grep ${CLUSTER}-pulsar-broker | wc -l) if [[ ${WC} -gt 1 ]]; then ${KUBECTL} describe pod -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 diff --git a/.github/workflows/test-e2e-crypto.yml b/.github/workflows/test-e2e-crypto.yml index ebebe7203..3397d5734 100644 --- a/.github/workflows/test-e2e-crypto.yml +++ b/.github/workflows/test-e2e-crypto.yml @@ -13,6 +13,7 @@ on: - 'tools/README.md' jobs: lint-test: + if: false runs-on: ubuntu-latest steps: - name: clean disk @@ -42,7 +43,7 @@ jobs: - name: Build runner images run: | - PULSAR_IMAGE_TAG=2.10.0.0-rc10 PULSAR_IMAGE=streamnative/pulsar-all KIND_PUSH=true images/build.sh + PULSAR_IMAGE_TAG=2.9.2.23 PULSAR_IMAGE=streamnative/pulsar-all KIND_PUSH=true images/build.sh - name: Install operator-sdk run: | diff --git a/.github/workflows/test-function-runner.yml b/.github/workflows/test-function-runner.yml index cc5aa1bcb..f9027fa99 100644 --- a/.github/workflows/test-function-runner.yml +++ b/.github/workflows/test-function-runner.yml @@ -42,7 +42,7 @@ jobs: - name: Build runner images run: | - PULSAR_IMAGE_TAG=2.10.0.0-rc10 PULSAR_IMAGE=streamnative/pulsar-all KIND_PUSH=true images/build.sh + PULSAR_IMAGE_TAG=2.9.2.23 PULSAR_IMAGE=streamnative/pulsar-all KIND_PUSH=true images/build.sh - name: Verify function runner run: | diff --git a/.github/workflows/test-integration-kind-samples.yml b/.github/workflows/test-integration-kind-samples.yml index a9d989ca8..2c3b5bbb7 100644 --- a/.github/workflows/test-integration-kind-samples.yml +++ b/.github/workflows/test-integration-kind-samples.yml @@ -152,6 +152,48 @@ jobs: .ci/verify_function_mesh.sh compute_v1alpha1_function_stateful kubectl delete -f .ci/clusters/compute_v1alpha1_function_stateful.yaml + - name: Test Sink Kind - Install ES Server + run: | + kubectl apply -f https://download.elastic.co/downloads/eck/1.2.1/all-in-one.yaml + kubectl apply -f config/samples/elasticsearch.yaml + + - name: Test Sink Kind - Start Sink Kind + run: | + kubectl apply -f config/samples/compute_v1alpha1_sink.yaml + kubectl get sinks + + - name: Verify Sink + run: | + .ci/verify_function_mesh.sh sink-sample + kubectl delete -f config/samples/compute_v1alpha1_sink.yaml + kubectl delete -f config/samples/elasticsearch.yaml + kubectl delete -f https://download.elastic.co/downloads/eck/1.2.1/all-in-one.yaml + + - name: Test Source Kind - Install Mongo DB Server + run: | + kubectl apply -f config/samples/mongodb-dbz.yaml + + - name: Test Source Kind - Start Source Kind + run: | + kubectl apply -f config/samples/compute_v1alpha1_source.yaml + kubectl get sources + + - name: Verify Source + run: | + .ci/verify_function_mesh.sh source-sample + kubectl delete -f config/samples/compute_v1alpha1_source.yaml + kubectl delete -f config/samples/mongodb-dbz.yaml + + - name: Test Crypto Function kind + run: | + kubectl apply -f config/samples/compute_v1alpha1_function_crypto.yaml + kubectl get all + + - name: Verify Crypto Function Mesh + run: | + .ci/verify_function_mesh.sh function-crypto-sample + kubectl delete -f config/samples/compute_v1alpha1_function_crypto.yaml + - name: Setup tmate session uses: mxschmitt/action-tmate@v3 if: failure() diff --git a/.github/workflows/test-sink.yml b/.github/workflows/test-sink.yml index e2f814ee7..1d4f72c0d 100644 --- a/.github/workflows/test-sink.yml +++ b/.github/workflows/test-sink.yml @@ -13,6 +13,7 @@ on: - 'tools/README.md' jobs: lint-test: + if: false runs-on: ubuntu-latest steps: - name: clean disk diff --git a/.github/workflows/test-source.yml b/.github/workflows/test-source.yml index 6b3a55dc4..a1b05f8be 100644 --- a/.github/workflows/test-source.yml +++ b/.github/workflows/test-source.yml @@ -13,6 +13,7 @@ on: - 'tools/README.md' jobs: lint-test: + if: false runs-on: ubuntu-latest steps: - name: clean disk From 7fbc2148d59bda71e69431f255caac66aeb501c9 Mon Sep 17 00:00:00 2001 From: laminar Date: Thu, 7 Jul 2022 13:49:31 +0800 Subject: [PATCH 11/17] upgrade kind cluster from v1.17.17 to v1.18.20 Signed-off-by: laminar --- .github/workflows/test-helm-charts.yml | 2 +- hack/kind-cluster-build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-helm-charts.yml b/.github/workflows/test-helm-charts.yml index 47cd05a17..761f7f8d2 100644 --- a/.github/workflows/test-helm-charts.yml +++ b/.github/workflows/test-helm-charts.yml @@ -73,7 +73,7 @@ jobs: if: steps.list-changed.outputs.changed == 'true' - name: Create kind cluster - run: hack/kind-cluster-build.sh --name chart-testing -c 3 -v 10 --k8sVersion v1.17.17 + run: hack/kind-cluster-build.sh --name chart-testing -c 3 -v 10 --k8sVersion v1.18.20 if: steps.list-changed.outputs.changed == 'true' - name: Set up GO 1.18 diff --git a/hack/kind-cluster-build.sh b/hack/kind-cluster-build.sh index 0e80db5b9..0fce3f13f 100755 --- a/hack/kind-cluster-build.sh +++ b/hack/kind-cluster-build.sh @@ -82,7 +82,7 @@ done clusterName=${clusterName:-pulsar-dev} nodeNum=${nodeNum:-6} -k8sVersion=${k8sVersion:-v1.17.17} +k8sVersion=${k8sVersion:-v1.18.20} volumeNum=${volumeNum:-9} echo "clusterName: ${clusterName}" From 4d3c75fa3447a3b41aa2c06f0d1c6c1eb56dc80a Mon Sep 17 00:00:00 2001 From: laminar Date: Thu, 7 Jul 2022 15:10:12 +0800 Subject: [PATCH 12/17] wait for function-mesh operator webhook ready Signed-off-by: laminar --- .github/workflows/test-integration-kind-samples.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-integration-kind-samples.yml b/.github/workflows/test-integration-kind-samples.yml index 2c3b5bbb7..43782e237 100644 --- a/.github/workflows/test-integration-kind-samples.yml +++ b/.github/workflows/test-integration-kind-samples.yml @@ -80,7 +80,14 @@ jobs: run: | helm install function-mesh -n function-mesh --set operatorImage=function-mesh-operator:latest --create-namespace charts/function-mesh-operator kubectl wait --for=condition=Ready -l app.kubernetes.io/name=function-mesh-operator pods -n function-mesh --timeout=5m - kubectl get pods -n function-mesh + while true; do + kubectl get pods -n function-mesh + kubectl logs -n function-mesh -l app.kubernetes.io/name=function-mesh-operator --tail=-1 | grep "serving webhook server" + if [ $? -eq 0 ]; then + break + fi + sleep 5s + done - name: Test Function kind - Java Function run: | From fe4b0338e1e7891d0f8a7787421c9c108c3aa1c5 Mon Sep 17 00:00:00 2001 From: laminar Date: Thu, 7 Jul 2022 16:01:27 +0800 Subject: [PATCH 13/17] fix crypto function Signed-off-by: laminar --- config/samples/compute_v1alpha1_function_crypto.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/samples/compute_v1alpha1_function_crypto.yaml b/config/samples/compute_v1alpha1_function_crypto.yaml index 9755472f9..ef91810c3 100644 --- a/config/samples/compute_v1alpha1_function_crypto.yaml +++ b/config/samples/compute_v1alpha1_function_crypto.yaml @@ -4,6 +4,7 @@ metadata: name: java-function-crypto-sample namespace: default spec: + image: streamnative/pulsar-functions-java-sample:2.9.2.23 className: org.apache.pulsar.functions.api.examples.ExclamationFunction forwardSourceMessageProperty: true maxPendingAsyncRequests: 1000 @@ -53,7 +54,6 @@ spec: pulsarConfig: "test-pulsar" java: jar: pulsar-functions-api-examples.jar - jarLocation: public/default/nlu-test-java-function # to be delete & use admission hook clusterName: test-pulsar autoAck: true @@ -63,8 +63,8 @@ kind: ConfigMap metadata: name: test-pulsar data: - webServiceURL: http://test-pulsar-broker.default.svc.cluster.local:8080 - brokerServiceURL: pulsar://test-pulsar-broker.default.svc.cluster.local:6650 + webServiceURL: http://sn-platform-pulsar-broker.default.svc.cluster.local:8080 + brokerServiceURL: pulsar://sn-platform-pulsar-broker.default.svc.cluster.local:6650 --- apiVersion: v1 data: From a74a3e7a41685749ccd153c589c3728c376f6ddf Mon Sep 17 00:00:00 2001 From: laminar Date: Thu, 7 Jul 2022 16:48:15 +0800 Subject: [PATCH 14/17] disable sink,source tests Signed-off-by: laminar --- .ci/helm.sh | 3 - .../test-integration-kind-samples.yml | 62 +++++++++---------- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/.ci/helm.sh b/.ci/helm.sh index 4bb9a4435..b63080fa7 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -99,9 +99,6 @@ function ci::install_pulsar_charts() { echo ${WC}; sleep 20 ${KUBECTL} get pods -n ${NAMESPACE} - for po in $(${KUBECTL} get pods -l app=pulsar --no-headers | grep -v "Running" | awk '{ print 1 }'); do - ${KUBECTL} logs "$po" --all-containers=true --tail=50 - done WC=$(${KUBECTL} get pods -n ${NAMESPACE} | grep ${CLUSTER}-pulsar-broker | wc -l) if [[ ${WC} -gt 1 ]]; then ${KUBECTL} describe pod -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 diff --git a/.github/workflows/test-integration-kind-samples.yml b/.github/workflows/test-integration-kind-samples.yml index 43782e237..0db58e04f 100644 --- a/.github/workflows/test-integration-kind-samples.yml +++ b/.github/workflows/test-integration-kind-samples.yml @@ -159,37 +159,37 @@ jobs: .ci/verify_function_mesh.sh compute_v1alpha1_function_stateful kubectl delete -f .ci/clusters/compute_v1alpha1_function_stateful.yaml - - name: Test Sink Kind - Install ES Server - run: | - kubectl apply -f https://download.elastic.co/downloads/eck/1.2.1/all-in-one.yaml - kubectl apply -f config/samples/elasticsearch.yaml - - - name: Test Sink Kind - Start Sink Kind - run: | - kubectl apply -f config/samples/compute_v1alpha1_sink.yaml - kubectl get sinks - - - name: Verify Sink - run: | - .ci/verify_function_mesh.sh sink-sample - kubectl delete -f config/samples/compute_v1alpha1_sink.yaml - kubectl delete -f config/samples/elasticsearch.yaml - kubectl delete -f https://download.elastic.co/downloads/eck/1.2.1/all-in-one.yaml - - - name: Test Source Kind - Install Mongo DB Server - run: | - kubectl apply -f config/samples/mongodb-dbz.yaml - - - name: Test Source Kind - Start Source Kind - run: | - kubectl apply -f config/samples/compute_v1alpha1_source.yaml - kubectl get sources - - - name: Verify Source - run: | - .ci/verify_function_mesh.sh source-sample - kubectl delete -f config/samples/compute_v1alpha1_source.yaml - kubectl delete -f config/samples/mongodb-dbz.yaml +# - name: Test Sink Kind - Install ES Server +# run: | +# kubectl apply -f https://download.elastic.co/downloads/eck/1.2.1/all-in-one.yaml +# kubectl apply -f config/samples/elasticsearch.yaml +# +# - name: Test Sink Kind - Start Sink Kind +# run: | +# kubectl apply -f config/samples/compute_v1alpha1_sink.yaml +# kubectl get sinks +# +# - name: Verify Sink +# run: | +# .ci/verify_function_mesh.sh sink-sample +# kubectl delete -f config/samples/compute_v1alpha1_sink.yaml +# kubectl delete -f config/samples/elasticsearch.yaml +# kubectl delete -f https://download.elastic.co/downloads/eck/1.2.1/all-in-one.yaml +# +# - name: Test Source Kind - Install Mongo DB Server +# run: | +# kubectl apply -f config/samples/mongodb-dbz.yaml +# +# - name: Test Source Kind - Start Source Kind +# run: | +# kubectl apply -f config/samples/compute_v1alpha1_source.yaml +# kubectl get sources +# +# - name: Verify Source +# run: | +# .ci/verify_function_mesh.sh source-sample +# kubectl delete -f config/samples/compute_v1alpha1_source.yaml +# kubectl delete -f config/samples/mongodb-dbz.yaml - name: Test Crypto Function kind run: | From 234e47d98b664c33da44d91a0a678b83977593ac Mon Sep 17 00:00:00 2001 From: laminar Date: Thu, 7 Jul 2022 17:51:44 +0800 Subject: [PATCH 15/17] improve install pulsar cluster Signed-off-by: laminar --- .ci/clusters/values.yaml | 11 ++- .ci/clusters/values_runner_images.yaml | 6 +- .ci/deploy_pulsar_cluster.sh | 2 + .ci/helm.sh | 22 +++--- .github/workflows/test-e2e-crypto.yml | 72 ------------------- .../test-function-key-based-batcher.yml | 71 ------------------ .../test-integration-kind-samples.yml | 38 ++++++---- .github/workflows/test-sink.yml | 68 ------------------ .github/workflows/test-source.yml | 67 ----------------- 9 files changed, 42 insertions(+), 315 deletions(-) delete mode 100644 .github/workflows/test-e2e-crypto.yml delete mode 100644 .github/workflows/test-function-key-based-batcher.yml delete mode 100644 .github/workflows/test-sink.yml delete mode 100644 .github/workflows/test-source.yml diff --git a/.ci/clusters/values.yaml b/.ci/clusters/values.yaml index e55000b37..e041e1a77 100644 --- a/.ci/clusters/values.yaml +++ b/.ci/clusters/values.yaml @@ -30,6 +30,7 @@ components: autorecovery: false pulsar_manager: false sql_worker: false + proxy: false ## disable monitoring stack monitoring: @@ -39,6 +40,7 @@ monitoring: grafana: false # monitoring - node_exporter node_exporter: false + loki: false images: zookeeper: @@ -67,7 +69,8 @@ zookeeper: replicaCount: 1 bookkeeper: - replicaCount: 1 + # Ensure that the bookkeeper starts after the pulsar-init job is completed + replicaCount: 0 metadata: image: repository: streamnative/pulsar-all @@ -77,9 +80,6 @@ bookkeeper: PULSAR_PREFIX_dlog.bkcEnsembleSize: "1" PULSAR_PREFIX_dlog.bkcWriteQuorumSize: "1" PULSAR_PREFIX_dlog.bkcAckQuorumSize: "1" - PULSAR_PREFIX_storage.range.store.dirs: "/pulsar/data/bookkeeper/ranges" - PULSAR_PREFIX_storage.serve.readonly.tables: "false" - PULSAR_PREFIX_storageserver.grpc.port: "4181" # `BOOKIE_MEM` is used for `bookie shell` BOOKIE_MEM: > -Xms128m @@ -121,8 +121,5 @@ broker: managedLedgerDefaultWriteQuorum: "1" managedLedgerDefaultAckQuorum: "1" -proxy: - replicaCount: 1 - functions: functionState: true diff --git a/.ci/clusters/values_runner_images.yaml b/.ci/clusters/values_runner_images.yaml index ee327492a..4a95b368e 100644 --- a/.ci/clusters/values_runner_images.yaml +++ b/.ci/clusters/values_runner_images.yaml @@ -27,6 +27,7 @@ affinity: components: autorecovery: false pulsar_manager: false + sql_worker: false ## disable monitoring stack monitoring: @@ -71,7 +72,7 @@ zookeeper: replicaCount: 1 bookkeeper: - replicaCount: 1 + replicaCount: 0 metadata: image: repository: streamnative/pulsar-all @@ -81,9 +82,6 @@ bookkeeper: PULSAR_PREFIX_dlog.bkcEnsembleSize: "1" PULSAR_PREFIX_dlog.bkcWriteQuorumSize: "1" PULSAR_PREFIX_dlog.bkcAckQuorumSize: "1" - PULSAR_PREFIX_storage.range.store.dirs: "/pulsar/data/bookkeeper/ranges" - PULSAR_PREFIX_storage.serve.readonly.tables: "false" - PULSAR_PREFIX_storageserver.grpc.port: "4181" # `BOOKIE_MEM` is used for `bookie shell` BOOKIE_MEM: > -Xms128m diff --git a/.ci/deploy_pulsar_cluster.sh b/.ci/deploy_pulsar_cluster.sh index bc51f940d..bd0fe10f2 100755 --- a/.ci/deploy_pulsar_cluster.sh +++ b/.ci/deploy_pulsar_cluster.sh @@ -49,3 +49,5 @@ ci::install_pulsar_charts "$VALUES_FILE" # test producer ci::test_pulsar_producer +# enable stream storage server +#ci::enable_stream_storage_server diff --git a/.ci/helm.sh b/.ci/helm.sh index b63080fa7..306c75340 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -93,25 +93,21 @@ function ci::install_pulsar_charts() { helm dependency update pulsar ${HELM} install sn-platform --set initialize=true --values ./pulsar/mini_values.yaml ./pulsar --debug - echo "wait until broker is alive" - WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep ${CLUSTER}-pulsar-broker | wc -l) - while [[ ${WC} -lt 1 ]]; do - echo ${WC}; - sleep 20 - ${KUBECTL} get pods -n ${NAMESPACE} - WC=$(${KUBECTL} get pods -n ${NAMESPACE} | grep ${CLUSTER}-pulsar-broker | wc -l) - if [[ ${WC} -gt 1 ]]; then - ${KUBECTL} describe pod -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 - ${KUBECTL} describe pod -n ${NAMESPACE} ${CLUSTER}-pulsar-bookie-0 - fi - WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep ${CLUSTER}-pulsar-broker | wc -l) + echo "wait until pulsar init job is completed" + succeeded_num=0 + while [[ ${succeeded_num} -lt 1 ]]; do + sleep 10s + kubectl get pods -n ${NAMESPACE} + succeeded_num=$(kubectl get jobs -n ${NAMESPACE} sn-platform-pulsar-pulsar-init -o jsonpath='{.status.succeeded}') done + kubectl scale statefulset --replicas=1 -n ${NAMESPACE} sn-platform-pulsar-bookie + echo "wait until pulsar cluster is active" + ${KUBECTL} wait --for=condition=Ready -n ${NAMESPACE} -l app=pulsar pods --timeout=5m ${KUBECTL} get service -n ${NAMESPACE} } function ci::test_pulsar_producer() { - sleep 120 # broker ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-toolset-0 -- bash -c 'until nslookup sn-platform-pulsar-broker; do sleep 3; done' ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin tenants create sn-platform diff --git a/.github/workflows/test-e2e-crypto.yml b/.github/workflows/test-e2e-crypto.yml deleted file mode 100644 index 3397d5734..000000000 --- a/.github/workflows/test-e2e-crypto.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Precommit - Test Function Kind with E2E Crypto -on: - pull_request: - branches: - - '*' - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - 'PROJECT' - - 'LICENSE' - - 'mesh-worker-service/README.md' - - 'tools/README.md' -jobs: - lint-test: - if: false - runs-on: ubuntu-latest - steps: - - name: clean disk - run: | - sudo swapoff -a - sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc - sudo apt clean - docker rmi $(docker images -q) -f - df -h - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - - name: Deploy k8s cluster env - uses: nick-invision/retry@v2 - with: - timeout_minutes: 60 - max_attempts: 3 - retry_on: error - command: | - .ci/deploy_pulsar_cluster.sh - on_retry_command: | - .ci/cleanup.sh - - - name: Build runner images - run: | - PULSAR_IMAGE_TAG=2.9.2.23 PULSAR_IMAGE=streamnative/pulsar-all KIND_PUSH=true images/build.sh - - - name: Install operator-sdk - run: | - RELEASE_VERSION=v1.6.1 - curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu - chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu - - # - name: Add CRD, controller or webhooks - # run: | - # operator-sdk create api --group cloud --version v1alpha1 --kind Function --resource=true --controller=true - # operator-sdk create webhook --group compute.functionmesh.io --version v1alpha1 --kind Function --defaulting --programmatic-validation - - - name: Deploy function mesh server - run: | - make generate - make install - nohup make run & - - - name: Test Function kind - run: | - kubectl apply -f config/samples/compute_v1alpha1_function_crypto.yaml - kubectl get all - - - name: Verify Function Mesh - run: | - .ci/verify_function_mesh.sh function-crypto-sample diff --git a/.github/workflows/test-function-key-based-batcher.yml b/.github/workflows/test-function-key-based-batcher.yml deleted file mode 100644 index 6e50b5808..000000000 --- a/.github/workflows/test-function-key-based-batcher.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Precommit - Test Function Kind with Key Based Batcher -on: - pull_request: - branches: - - '*' - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - 'PROJECT' - - 'LICENSE' - - 'mesh-worker-service/README.md' - - 'tools/README.md' -jobs: - lint-test: - runs-on: ubuntu-latest - steps: - - name: clean disk - run: | - sudo swapoff -a - sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc - sudo apt clean - docker rmi $(docker images -q) -f - df -h - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - - name: Deploy k8s cluster env - uses: nick-invision/retry@v2 - with: - timeout_minutes: 60 - max_attempts: 3 - retry_on: error - command: | - .ci/deploy_pulsar_cluster.sh - on_retry_command: | - .ci/cleanup.sh - - - name: Build runner images - run: | - PULSAR_IMAGE_TAG=2.10.0.0-rc10 PULSAR_IMAGE=streamnative/pulsar-all KIND_PUSH=true images/build.sh - - - name: Install operator-sdk - run: | - RELEASE_VERSION=v1.6.1 - curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu - chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu - - # - name: Add CRD, controller or webhooks - # run: | - # operator-sdk create api --group cloud --version v1alpha1 --kind Function --resource=true --controller=true - # operator-sdk create webhook --group compute.functionmesh.io --version v1alpha1 --kind Function --defaulting --programmatic-validation - - - name: Deploy function mesh server - run: | - make generate - make install - nohup make run & - - - name: Test Function kind - run: | - kubectl apply -f config/samples/compute_v1alpha1_function_key_based_batcher.yaml - kubectl get all - - - name: Verify Function Mesh - run: | - .ci/verify_function_mesh.sh java-function-batcher-sample diff --git a/.github/workflows/test-integration-kind-samples.yml b/.github/workflows/test-integration-kind-samples.yml index 0db58e04f..e7cd3285d 100644 --- a/.github/workflows/test-integration-kind-samples.yml +++ b/.github/workflows/test-integration-kind-samples.yml @@ -38,12 +38,15 @@ jobs: retry_on: error command: | .ci/deploy_pulsar_cluster.sh - helm repo add jetstack https://charts.jetstack.io - helm repo update - helm install cert-manager jetstack/cert-manager --set installCRDs=true on_retry_command: | .ci/cleanup.sh + - name: Install cert manager + run: | + helm repo add jetstack https://charts.jetstack.io + helm repo update + helm install cert-manager jetstack/cert-manager --set installCRDs=true + - name: Build runner images run: | PULSAR_IMAGE_TAG=2.9.2.23 PULSAR_IMAGE=streamnative/pulsar-all KIND_PUSH=true images/build.sh @@ -190,16 +193,25 @@ jobs: # .ci/verify_function_mesh.sh source-sample # kubectl delete -f config/samples/compute_v1alpha1_source.yaml # kubectl delete -f config/samples/mongodb-dbz.yaml - - - name: Test Crypto Function kind - run: | - kubectl apply -f config/samples/compute_v1alpha1_function_crypto.yaml - kubectl get all - - - name: Verify Crypto Function Mesh - run: | - .ci/verify_function_mesh.sh function-crypto-sample - kubectl delete -f config/samples/compute_v1alpha1_function_crypto.yaml +# +# - name: Test Function kind +# run: | +# kubectl apply -f config/samples/compute_v1alpha1_function_key_based_batcher.yaml +# kubectl get all +# +# - name: Verify Function Mesh +# run: | +# .ci/verify_function_mesh.sh java-function-batcher-sample +# +# - name: Test Crypto Function kind +# run: | +# kubectl apply -f config/samples/compute_v1alpha1_function_crypto.yaml +# kubectl get all +# +# - name: Verify Crypto Function Mesh +# run: | +# .ci/verify_function_mesh.sh function-crypto-sample +# kubectl delete -f config/samples/compute_v1alpha1_function_crypto.yaml - name: Setup tmate session uses: mxschmitt/action-tmate@v3 diff --git a/.github/workflows/test-sink.yml b/.github/workflows/test-sink.yml deleted file mode 100644 index 1d4f72c0d..000000000 --- a/.github/workflows/test-sink.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Precommit - Test Sink Kind -on: - pull_request: - branches: - - '*' - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - 'PROJECT' - - 'LICENSE' - - 'mesh-worker-service/README.md' - - 'tools/README.md' -jobs: - lint-test: - if: false - runs-on: ubuntu-latest - steps: - - name: clean disk - run: | - sudo swapoff -a - sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc - sudo apt clean - docker rmi $(docker images -q) -f - df -h - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - - name: Deploy k8s cluster env - uses: nick-invision/retry@v2 - with: - timeout_minutes: 60 - max_attempts: 3 - retry_on: error - command: | - .ci/deploy_pulsar_cluster.sh - on_retry_command: | - .ci/cleanup.sh - - - name: Install operator-sdk - run: | - RELEASE_VERSION=v1.6.1 - curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu - chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu - - - name: Deploy function mesh server - run: | - make generate - make install - nohup make run & - - - name: Install ES Server - run: | - kubectl apply -f https://download.elastic.co/downloads/eck/1.2.1/all-in-one.yaml - kubectl apply -f config/samples/elasticsearch.yaml - - - name: Start Sink Kind - run: | - kubectl apply -f config/samples/compute_v1alpha1_sink.yaml - kubectl get sinks - - - name: Verify Sink - run: | - .ci/verify_function_mesh.sh sink-sample diff --git a/.github/workflows/test-source.yml b/.github/workflows/test-source.yml deleted file mode 100644 index a1b05f8be..000000000 --- a/.github/workflows/test-source.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Precommit - Test Source Kind -on: - pull_request: - branches: - - '*' - paths-ignore: - - 'docs/**' - - 'README.md' - - 'CHANGELOG.md' - - 'PROJECT' - - 'LICENSE' - - 'mesh-worker-service/README.md' - - 'tools/README.md' -jobs: - lint-test: - if: false - runs-on: ubuntu-latest - steps: - - name: clean disk - run: | - sudo swapoff -a - sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc - sudo apt clean - docker rmi $(docker images -q) -f - df -h - - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - - name: Deploy k8s cluster env - uses: nick-invision/retry@v2 - with: - timeout_minutes: 60 - max_attempts: 3 - retry_on: error - command: | - .ci/deploy_pulsar_cluster.sh - on_retry_command: | - .ci/cleanup.sh - - - name: Install operator-sdk - run: | - RELEASE_VERSION=v1.6.1 - curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu - chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo mkdir -p /usr/local/bin/ && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu - - - name: Deploy function mesh server - run: | - make generate - make install - nohup make run & - - - name: Install Mongo DB Server - run: | - kubectl apply -f config/samples/mongodb-dbz.yaml - - - name: Start Source Kind - run: | - kubectl apply -f config/samples/compute_v1alpha1_source.yaml - kubectl get sources - - - name: Verify Source - run: | - .ci/verify_function_mesh.sh source-sample From a1dc572a12fb54dc3fe814fe2b81263c499ec059 Mon Sep 17 00:00:00 2001 From: laminar Date: Fri, 8 Jul 2022 15:58:42 +0800 Subject: [PATCH 16/17] update runner test Signed-off-by: laminar --- .ci/helm.sh | 91 ++++++++++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/.ci/helm.sh b/.ci/helm.sh index 306c75340..cb29b3405 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -83,7 +83,7 @@ function ci::install_pulsar_charts() { values=${1:-".ci/clusters/values.yaml"} echo $values if [ -d "pulsar-charts" ]; then - rm -rf pulsar-charts + rm -rf pulsar-charts fi git clone https://github.com/streamnative/charts.git pulsar-charts cp ${values} pulsar-charts/charts/pulsar/mini_values.yaml @@ -96,9 +96,9 @@ function ci::install_pulsar_charts() { echo "wait until pulsar init job is completed" succeeded_num=0 while [[ ${succeeded_num} -lt 1 ]]; do - sleep 10s - kubectl get pods -n ${NAMESPACE} - succeeded_num=$(kubectl get jobs -n ${NAMESPACE} sn-platform-pulsar-pulsar-init -o jsonpath='{.status.succeeded}') + sleep 10s + kubectl get pods -n ${NAMESPACE} + succeeded_num=$(kubectl get jobs -n ${NAMESPACE} sn-platform-pulsar-pulsar-init -o jsonpath='{.status.succeeded}') done kubectl scale statefulset --replicas=1 -n ${NAMESPACE} sn-platform-pulsar-bookie @@ -165,50 +165,49 @@ function ci::verify_hpa() { } function ci::test_function_runners() { - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-java --className org.apache.pulsar.functions.api.examples.ExclamationFunction --inputs persistent://public/default/test-java-input --jar /pulsar/examples/api-examples.jar --cpu 0.1 - sleep 15 - ${KUBECTL} get pods -A - sleep 5 - WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep "test-java" | wc -l) - while [[ ${WC} -lt 1 ]]; do - echo ${WC}; - sleep 20 - ${KUBECTL} get pods -n ${NAMESPACE} - ${KUBECTL} describe pod pf-public-default-test-java-0 - WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep "test-java" | wc -l) - done - echo "java runner test done" - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-java + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-java --className org.apache.pulsar.functions.api.examples.ExclamationFunction --inputs persistent://public/default/test-java-input --jar /pulsar/examples/api-examples.jar --cpu 0.1 + function_num=0 + while [[ ${function_num} -lt 1 ]]; do + sleep 5s + kubectl get pods -n ${NAMESPACE} + function_num=$(kubectl get pods -n ${NAMESPACE} -l name=test-java --no-headers | wc -l) + done + kubectl wait --for=condition=Ready -n ${NAMESPACE} -l name=test-java pods && true + if [ $? -ne 0 ]; then + exit 1 + fi + echo "java runner test done" + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-java - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-python --classname exclamation_function.ExclamationFunction --inputs persistent://public/default/test-python-input --py /pulsar/examples/python-examples/exclamation_function.py --cpu 0.1 - sleep 15 - ${KUBECTL} get pods -A - sleep 5 - WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep "test-python" | wc -l) - while [[ ${WC} -lt 1 ]]; do - echo ${WC}; - sleep 20 - ${KUBECTL} get pods -n ${NAMESPACE} - WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep "test-python" | wc -l) - done - echo "python runner test done" - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-python + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-python --classname exclamation_function.ExclamationFunction --inputs persistent://public/default/test-python-input --py /pulsar/examples/python-examples/exclamation_function.py --cpu 0.1 + function_num=0 + while [[ ${function_num} -lt 1 ]]; do + sleep 5s + kubectl get pods -n ${NAMESPACE} + function_num=$(kubectl get pods -n ${NAMESPACE} -l name=test-python --no-headers | wc -l) + done + kubectl wait --for=condition=Ready -n ${NAMESPACE} -l name=test-python pods && true + if [ $? -ne 0 ]; then + exit 1 + fi + echo "python runner test done" + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-python - ${KUBECTL} cp "${FUNCTION_MESH_HOME}/.ci/examples/go-examples" "${NAMESPACE}/${CLUSTER}-pulsar-broker-0:/pulsar/" - sleep 1 - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-go --inputs persistent://public/default/test-go-input --go /pulsar/go-examples/exclamationFunc --cpu 0.1 - sleep 15 - ${KUBECTL} get pods -A - sleep 5 - WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep "test-go" | wc -l) - while [[ ${WC} -lt 1 ]]; do - echo ${WC}; - sleep 20 - ${KUBECTL} get pods -n ${NAMESPACE} - WC=$(${KUBECTL} get pods -n ${NAMESPACE} --field-selector=status.phase=Running | grep "test-go" | wc -l) - done - echo "golang runner test done" - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-go + kubectl cp "${FUNCTION_MESH_HOME}/.ci/examples/go-examples" "${NAMESPACE}/${CLUSTER}-pulsar-broker-0:/pulsar/" + sleep 1 + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-go --inputs persistent://public/default/test-go-input --go /pulsar/go-examples/exclamationFunc --cpu 0.1 + function_num=0 + while [[ ${function_num} -lt 1 ]]; do + sleep 5s + kubectl get pods -n ${NAMESPACE} + function_num=$(kubectl get pods -n ${NAMESPACE} -l name=test-go --no-headers | wc -l) + done + kubectl wait --for=condition=Ready -n ${NAMESPACE} -l name=test-go pods && true + if [ $? -ne 0 ]; then + exit 1 + fi + echo "golang runner test done" + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-go } function ci::verify_go_function() { From 8f94eb01a10b317ee308becedadda67b4b0a4ae7 Mon Sep 17 00:00:00 2001 From: laminar Date: Fri, 8 Jul 2022 16:27:30 +0800 Subject: [PATCH 17/17] fix typo Signed-off-by: laminar --- .ci/helm.sh | 160 ++++++++---------- .../test-integration-kind-samples.yml | 10 +- 2 files changed, 78 insertions(+), 92 deletions(-) diff --git a/.ci/helm.sh b/.ci/helm.sh index cb29b3405..33049ca15 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -35,13 +35,13 @@ FUNCTION_NAME=$1 function ci::create_cluster() { echo "Creating a kind cluster ..." - ${FUNCTION_MESH_HOME}/hack/kind-cluster-build.sh --name sn-platform-${CLUSTER_ID} -c 3 -v 10 + ${FUNCTION_MESH_HOME}/hack/kind-cluster-build.sh --name sn-platform-"${CLUSTER_ID}" -c 3 -v 10 echo "Successfully created a kind cluster." } function ci::delete_cluster() { echo "Deleting a kind cluster ..." - kind delete cluster --name=sn-platform-${CLUSTER_ID} + kind delete cluster --name=sn-platform-"${CLUSTER_ID}" echo "Successfully delete a kind cluster." } @@ -71,10 +71,10 @@ function ci::install_metrics_server() { echo "Successfully installed the metrics-server." WC=$(${KUBECTL} get pods -n kube-system --field-selector=status.phase=Running | grep metrics-server | wc -l) while [[ ${WC} -lt 1 ]]; do - echo ${WC}; - sleep 20 - ${KUBECTL} get pods -n kube-system - WC=$(${KUBECTL} get pods -n kube-system --field-selector=status.phase=Running | grep metrics-server | wc -l) + echo ${WC}; + sleep 20 + ${KUBECTL} get pods -n kube-system + WC=$(${KUBECTL} get pods -n kube-system --field-selector=status.phase=Running | grep metrics-server | wc -l) done } @@ -100,11 +100,12 @@ function ci::install_pulsar_charts() { kubectl get pods -n ${NAMESPACE} succeeded_num=$(kubectl get jobs -n ${NAMESPACE} sn-platform-pulsar-pulsar-init -o jsonpath='{.status.succeeded}') done + # start bookkeeper after the pulsar init job is completed kubectl scale statefulset --replicas=1 -n ${NAMESPACE} sn-platform-pulsar-bookie echo "wait until pulsar cluster is active" - ${KUBECTL} wait --for=condition=Ready -n ${NAMESPACE} -l app=pulsar pods --timeout=5m - ${KUBECTL} get service -n ${NAMESPACE} + kubectl wait --for=condition=Ready -n ${NAMESPACE} -l app=pulsar pods --timeout=5m + kubectl get service -n ${NAMESPACE} } function ci::test_pulsar_producer() { @@ -122,28 +123,22 @@ function ci::test_pulsar_producer() { function ci::verify_function_mesh() { FUNCTION_NAME=$1 - while true; do - num=$(${KUBECTL} get pods -lname="${FUNCTION_NAME}" | wc -l) - if [ "$num" -gt 1 ]; then - break - else - ${KUBECTL} get pods -A - sleep 2s - fi + num=0 + while [[ ${num} -lt 1 ]]; do + sleep 5s + kubectl get pods + num=$(kubectl get pods -l name="${FUNCTION_NAME}" | wc -l) done - ${KUBECTL} wait -lname="${FUNCTION_NAME}" --for=condition=Ready pod --timeout=2m && true - if [ $? -eq 0 ]; then - while true; do - num=$(${KUBECTL} logs -lname="${FUNCTION_NAME}" --all-containers=true --tail=-1 | grep "Created producer\|Created consumer" | wc -l) - if [ "$num" -gt 0 ]; then - break - else - ${KUBECTL} logs -lname="${FUNCTION_NAME}" --all-containers=true --tail=-1 || true - sleep 5s - fi - done - fi + kubectl wait -l name="${FUNCTION_NAME}" --for=condition=Ready pod --timeout=2m && true + + num=0 + while [[ ${num} -lt 1 ]]; do + sleep 5s + kubectl get pods -l name="${FUNCTION_NAME}" + kubectl logs -l name="${FUNCTION_NAME}" --all-containers=true --tail=50 || true + num=$(kubectl logs -lname="${FUNCTION_NAME}" --all-containers=true --tail=-1 | grep "Created producer\|Created consumer" | wc -l) + done } function ci::verify_hpa() { @@ -155,59 +150,59 @@ function ci::verify_hpa() { ${KUBECTL} describe hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function WC=$(${KUBECTL} get hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function -o jsonpath='{.status.conditions[?(@.type=="AbleToScale")].status}' | grep False | wc -l) while [[ ${WC} -lt 0 ]]; do - echo ${WC}; - sleep 20 - ${KUBECTL} get hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function -o yaml - ${KUBECTL} describe hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function - ${KUBECTL} get hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function -o jsonpath='{.status.conditions[?(@.type=="AbleToScale")].status}' - WC=$(${KUBECTL} get hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function -o jsonpath='{.status.conditions[?(@.type=="AbleToScale")].status}' | grep False | wc -l) + echo ${WC}; + sleep 20 + ${KUBECTL} get hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function -o yaml + ${KUBECTL} describe hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function + ${KUBECTL} get hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function -o jsonpath='{.status.conditions[?(@.type=="AbleToScale")].status}' + WC=$(${KUBECTL} get hpa.v2beta2.autoscaling ${FUNCTION_NAME}-function -o jsonpath='{.status.conditions[?(@.type=="AbleToScale")].status}' | grep False | wc -l) done } function ci::test_function_runners() { - kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-java --className org.apache.pulsar.functions.api.examples.ExclamationFunction --inputs persistent://public/default/test-java-input --jar /pulsar/examples/api-examples.jar --cpu 0.1 - function_num=0 - while [[ ${function_num} -lt 1 ]]; do - sleep 5s - kubectl get pods -n ${NAMESPACE} - function_num=$(kubectl get pods -n ${NAMESPACE} -l name=test-java --no-headers | wc -l) - done - kubectl wait --for=condition=Ready -n ${NAMESPACE} -l name=test-java pods && true - if [ $? -ne 0 ]; then - exit 1 - fi - echo "java runner test done" - kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-java + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-java --className org.apache.pulsar.functions.api.examples.ExclamationFunction --inputs persistent://public/default/test-java-input --jar /pulsar/examples/api-examples.jar --cpu 0.1 + function_num=0 + while [[ ${function_num} -lt 1 ]]; do + sleep 5s + kubectl get pods -n ${NAMESPACE} + function_num=$(kubectl get pods -n ${NAMESPACE} -l name=test-java --no-headers | wc -l) + done + kubectl wait --for=condition=Ready -n ${NAMESPACE} -l name=test-java pods && true + if [ $? -ne 0 ]; then + exit 1 + fi + echo "java runner test done" + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-java - kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-python --classname exclamation_function.ExclamationFunction --inputs persistent://public/default/test-python-input --py /pulsar/examples/python-examples/exclamation_function.py --cpu 0.1 - function_num=0 - while [[ ${function_num} -lt 1 ]]; do - sleep 5s - kubectl get pods -n ${NAMESPACE} - function_num=$(kubectl get pods -n ${NAMESPACE} -l name=test-python --no-headers | wc -l) - done - kubectl wait --for=condition=Ready -n ${NAMESPACE} -l name=test-python pods && true - if [ $? -ne 0 ]; then - exit 1 - fi - echo "python runner test done" - kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-python + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-python --classname exclamation_function.ExclamationFunction --inputs persistent://public/default/test-python-input --py /pulsar/examples/python-examples/exclamation_function.py --cpu 0.1 + function_num=0 + while [[ ${function_num} -lt 1 ]]; do + sleep 5s + kubectl get pods -n ${NAMESPACE} + function_num=$(kubectl get pods -n ${NAMESPACE} -l name=test-python --no-headers | wc -l) + done + kubectl wait --for=condition=Ready -n ${NAMESPACE} -l name=test-python pods && true + if [ $? -ne 0 ]; then + exit 1 + fi + echo "python runner test done" + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-python - kubectl cp "${FUNCTION_MESH_HOME}/.ci/examples/go-examples" "${NAMESPACE}/${CLUSTER}-pulsar-broker-0:/pulsar/" - sleep 1 - kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-go --inputs persistent://public/default/test-go-input --go /pulsar/go-examples/exclamationFunc --cpu 0.1 - function_num=0 - while [[ ${function_num} -lt 1 ]]; do - sleep 5s - kubectl get pods -n ${NAMESPACE} - function_num=$(kubectl get pods -n ${NAMESPACE} -l name=test-go --no-headers | wc -l) - done - kubectl wait --for=condition=Ready -n ${NAMESPACE} -l name=test-go pods && true - if [ $? -ne 0 ]; then - exit 1 - fi - echo "golang runner test done" - kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-go + kubectl cp "${FUNCTION_MESH_HOME}/.ci/examples/go-examples" "${NAMESPACE}/${CLUSTER}-pulsar-broker-0:/pulsar/" + sleep 1 + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions create --tenant public --namespace default --name test-go --inputs persistent://public/default/test-go-input --go /pulsar/go-examples/exclamationFunc --cpu 0.1 + function_num=0 + while [[ ${function_num} -lt 1 ]]; do + sleep 5s + kubectl get pods -n ${NAMESPACE} + function_num=$(kubectl get pods -n ${NAMESPACE} -l name=test-go --no-headers | wc -l) + done + kubectl wait --for=condition=Ready -n ${NAMESPACE} -l name=test-go pods && true + if [ $? -ne 0 ]; then + exit 1 + fi + echo "golang runner test done" + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-admin functions delete --tenant public --namespace default --name test-go } function ci::verify_go_function() { @@ -230,22 +225,15 @@ function ci::verify_mesh_function() { ci:verify_exclamation_function "persistent://public/default/functionmesh-input-topic" "persistent://public/default/functionmesh-python-topic" "test-message" "test-message!!!" 10 } -function ci::print_function_log() { - FUNCTION_NAME=$1 - ${KUBECTL} describe pod -lname=${FUNCTION_NAME} - sleep 120 - ${KUBECTL} logs -lname=${FUNCTION_NAME} --all-containers=true -} - function ci:verify_exclamation_function() { inputtopic=$1 outputtopic=$2 inputmessage=$3 outputmessage=$4 timesleep=$5 - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "${inputmessage}" -n 1 "${inputtopic}" + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "${inputmessage}" -n 1 "${inputtopic}" sleep "$timesleep" - MESSAGE=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "sub" --subscription-position Earliest "${outputtopic}") + MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "sub" --subscription-position Earliest "${outputtopic}") echo "$MESSAGE" if [[ "$MESSAGE" == *"$outputmessage"* ]]; then return 0 @@ -259,9 +247,9 @@ function ci:verify_wordcount_function() { inputmessage=$3 outputmessage=$4 timesleep=$5 - ${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "${inputmessage}" -n 1 "${inputtopic}" + kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "${inputmessage}" -n 1 "${inputtopic}" sleep "$timesleep" - MESSAGE=$(${KUBECTL} exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 3 -s "sub" --subscription-position Earliest "${outputtopic}") + MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 3 -s "sub" --subscription-position Earliest "${outputtopic}") echo "$MESSAGE" if [[ "$MESSAGE" == *"$outputmessage"* ]]; then return 0 diff --git a/.github/workflows/test-integration-kind-samples.yml b/.github/workflows/test-integration-kind-samples.yml index e7cd3285d..8fddeb162 100644 --- a/.github/workflows/test-integration-kind-samples.yml +++ b/.github/workflows/test-integration-kind-samples.yml @@ -83,13 +83,11 @@ jobs: run: | helm install function-mesh -n function-mesh --set operatorImage=function-mesh-operator:latest --create-namespace charts/function-mesh-operator kubectl wait --for=condition=Ready -l app.kubernetes.io/name=function-mesh-operator pods -n function-mesh --timeout=5m - while true; do - kubectl get pods -n function-mesh - kubectl logs -n function-mesh -l app.kubernetes.io/name=function-mesh-operator --tail=-1 | grep "serving webhook server" - if [ $? -eq 0 ]; then - break - fi + num=0 + while [[ ${num} -lt 1 ]]; do sleep 5s + kubectl get pods -n function-mesh + num=$(kubectl logs -n function-mesh -l app.kubernetes.io/name=function-mesh-operator --tail=-1 | grep "serving webhook server" | wc -l) done - name: Test Function kind - Java Function