From 97dd12bd60053e2e9762fc48b89212aa44b053dd Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Tue, 5 Nov 2024 09:00:27 +0800 Subject: [PATCH] Use `/pulsar/instances/deps/*` instead of `/pulsar/lib/*` in classpath (#787) * Use `/pulsar/instances/deps/*` instead of `/pulsar/lib/*` in classpath * Fix error * Fix error --- .../integration/cases/java-download-function/manifests.yaml | 2 ++ controllers/spec/common.go | 2 +- images/pulsar-functions-java-runner/Dockerfile | 3 +++ images/pulsar-functions-java-runner/pulsarctl.Dockerfile | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.ci/tests/integration/cases/java-download-function/manifests.yaml b/.ci/tests/integration/cases/java-download-function/manifests.yaml index 4763bae5a..6827baf8d 100644 --- a/.ci/tests/integration/cases/java-download-function/manifests.yaml +++ b/.ci/tests/integration/cases/java-download-function/manifests.yaml @@ -49,6 +49,8 @@ spec: java: jar: pulsar-functions-api-examples.jar jarLocation: function://public/default/test-java-function + log: + javaLog4JConfigFileType: "yaml" # to be delete & use admission hook clusterName: test autoAck: true diff --git a/controllers/spec/common.go b/controllers/spec/common.go index abe5e34bc..8e711ac71 100644 --- a/controllers/spec/common.go +++ b/controllers/spec/common.go @@ -1188,7 +1188,7 @@ func getProcessJavaRuntimeArgs(name, packageName, clusterName, logLevel, details state *v1alpha1.Stateful, tlsConfig TLSConfig, authConfig *v1alpha1.AuthConfig, maxPendingAsyncRequests *int32, logConfigFileName string) []string { - classPath := "/pulsar/instances/java-instance.jar:/pulsar/lib/*" + classPath := "/pulsar/instances/java-instance.jar:/pulsar/instances/deps/*" javaLogConfigPath := logConfigFileName if javaLogConfigPath == "" { javaLogConfigPath = DefaultJavaLogConfigPath diff --git a/images/pulsar-functions-java-runner/Dockerfile b/images/pulsar-functions-java-runner/Dockerfile index 672befe98..e529da5c4 100644 --- a/images/pulsar-functions-java-runner/Dockerfile +++ b/images/pulsar-functions-java-runner/Dockerfile @@ -6,6 +6,9 @@ FROM pulsar-functions-runner-base:latest COPY --from=pulsar --chown=$UID:$GID /pulsar/instances/java-instance.jar /pulsar/instances/java-instance.jar COPY --from=pulsar --chown=$UID:$GID /pulsar/instances/deps /pulsar/instances/deps +RUN cp /pulsar/lib/com.fasterxml.jackson.dataformat-jackson-dataformat-yaml-*.jar /pulsar/instances/deps/dataformat-jackson-dataformat-yaml.jar \ + && cp /pulsar/lib/org.yaml-snakeyaml-*.jar /pulsar/instances/deps/org.yaml-snakeyaml.jar + WORKDIR /pulsar USER $USER diff --git a/images/pulsar-functions-java-runner/pulsarctl.Dockerfile b/images/pulsar-functions-java-runner/pulsarctl.Dockerfile index 55e5d4f54..2545190b4 100644 --- a/images/pulsar-functions-java-runner/pulsarctl.Dockerfile +++ b/images/pulsar-functions-java-runner/pulsarctl.Dockerfile @@ -45,6 +45,9 @@ RUN rm -rf /pulsar/lib/io.vertx-vertx-core-*.jar || true RUN rm -rf /pulsar/lib/presto || true RUN rm -rf /pulsar/conf/presto || true +RUN cp /pulsar/lib/com.fasterxml.jackson.dataformat-jackson-dataformat-yaml-*.jar /pulsar/instances/deps/dataformat-jackson-dataformat-yaml.jar \ + && cp /pulsar/lib/org.yaml-snakeyaml-*.jar /pulsar/instances/deps/org.yaml-snakeyaml.jar + ENV PULSAR_ROOT_LOGGER=INFO,CONSOLE ENV java.io.tmpdir=/pulsar/tmp/