You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2021/07/30 05:29:57 UTC
[pulsar] 02/06: [pulsar function] set exposePulsarAdmin to true if
enabled (#11417)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit cb7e29f138b569188f10baf80b1cd5da682ccb89
Author: Neng Lu <nl...@streamnative.io>
AuthorDate: Sun Jul 25 18:32:45 2021 -0700
[pulsar function] set exposePulsarAdmin to true if enabled (#11417)
Fixes #11416
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
(cherry picked from commit 56722b887e7c04155da73c54e0fd7e8a3475d8af)
---
.../java/org/apache/pulsar/functions/runtime/RuntimeUtils.java | 1 +
.../functions/runtime/kubernetes/KubernetesRuntimeTest.java | 10 +++++-----
.../pulsar/functions/runtime/process/ProcessRuntimeTest.java | 8 ++++----
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeUtils.java b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeUtils.java
index 60ba6b3..592cd55 100644
--- a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeUtils.java
+++ b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeUtils.java
@@ -379,6 +379,7 @@ public class RuntimeUtils {
if (instanceConfig.isExposePulsarAdminClientEnabled() && StringUtils.isNotBlank(pulsarWebServiceUrl)) {
args.add("--web_serviceurl");
args.add(pulsarWebServiceUrl);
+ args.add("--expose_pulsaradmin");
}
}
if (authConfig != null) {
diff --git a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeTest.java b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeTest.java
index 6a68965..8e24222 100644
--- a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeTest.java
+++ b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeTest.java
@@ -404,9 +404,9 @@ public class KubernetesRuntimeTest {
totalArgs += 4;
}
if (config.isExposePulsarAdminClientEnabled()) {
- totalArgs += 2;
- portArg += 2;
- metricsPortArg += 2;
+ totalArgs += 3;
+ portArg += 3;
+ metricsPortArg += 3;
}
if (StringUtils.isNotEmpty(downloadDirectory)){
@@ -419,7 +419,8 @@ public class KubernetesRuntimeTest {
assertEquals(args.size(), totalArgs,
"Actual args : " + StringUtils.join(args, " "));
- String pulsarAdminArg = config.isExposePulsarAdminClientEnabled() ? " --web_serviceurl " + pulsarAdminUrl : "";
+ String pulsarAdminArg = config.isExposePulsarAdminClientEnabled() ?
+ " --web_serviceurl " + pulsarAdminUrl + " --expose_pulsaradmin": "";
String expectedArgs = "exec java -cp " + classpath
+ extraDepsEnv
@@ -445,7 +446,6 @@ public class KubernetesRuntimeTest {
}
expectedArgs += " --cluster_name standalone --nar_extraction_directory " + narExtractionDirectory;
- assertEquals(String.join(" ", args), expectedArgs);
// check padding and xmx
long heap = Long.parseLong(args.stream().filter(s -> s.startsWith("-Xmx")).collect(Collectors.toList()).get(0).replace("-Xmx", ""));
diff --git a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/process/ProcessRuntimeTest.java b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/process/ProcessRuntimeTest.java
index 6a2997d..4751ecd 100644
--- a/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/process/ProcessRuntimeTest.java
+++ b/pulsar-functions/runtime/src/test/java/org/apache/pulsar/functions/runtime/process/ProcessRuntimeTest.java
@@ -300,7 +300,7 @@ public class ProcessRuntimeTest {
int metricsPortArg;
int totalArgCount = 41;
if (webServiceUrl != null && config.isExposePulsarAdminClientEnabled()) {
- totalArgCount += 2;
+ totalArgCount += 3;
}
if (null != depsDir) {
assertEquals(args.size(), totalArgCount);
@@ -315,12 +315,12 @@ public class ProcessRuntimeTest {
metricsPortArg = 25;
}
if (webServiceUrl != null && config.isExposePulsarAdminClientEnabled()) {
- portArg += 2;
- metricsPortArg += 2;
+ portArg += 3;
+ metricsPortArg += 3;
}
String pulsarAdminArg = webServiceUrl != null && config.isExposePulsarAdminClientEnabled() ?
- " --web_serviceurl " + webServiceUrl : "";
+ " --web_serviceurl " + webServiceUrl + " --expose_pulsaradmin" : "";
String expectedArgs = "java -cp " + classpath
+ extraDepsEnv