You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/05/19 00:49:33 UTC
[pulsar] 18/26: [pulsar-function] support bookie authentication
from function-worker (#4088)
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 4c2bb0cecad7ea9f537f5790d049ec5b3f2d994c
Author: Rajan Dhabalia <rd...@apache.org>
AuthorDate: Sun Apr 21 19:25:59 2019 -0700
[pulsar-function] support bookie authentication from function-worker (#4088)
### Motivation
Function worker uses bookie and zookeeper to store function's executable. However, function doesn't support authentication while connecting to bookie so, dbLog initialize fails when bookie requires auth&auth.
### Modification
Add bk-client authentication param to worker-config.
---
conf/functions_worker.yml | 10 ++++++++++
.../terraform-ansible/templates/functions_worker.yml | 9 +++++++++
.../java/org/apache/pulsar/functions/worker/Utils.java | 8 ++++++++
.../org/apache/pulsar/functions/worker/WorkerConfig.java | 15 +++++++++++++++
4 files changed, 42 insertions(+)
diff --git a/conf/functions_worker.yml b/conf/functions_worker.yml
index ea1456d..0266f2f 100644
--- a/conf/functions_worker.yml
+++ b/conf/functions_worker.yml
@@ -49,6 +49,16 @@ pulsarWebServiceUrl: http://localhost:8080
# the authentication parameter to be used by the pulsar client used in worker service
# clientAuthenticationParameters:
+# Bookie Authentication
+#
+# Authentication plugin to use when connecting to bookies
+# bookkeeperClientAuthenticationPlugin:
+# BookKeeper auth plugin implementatation specifics parameters name and values
+# bookkeeperClientAuthenticationParametersName:
+# Parameters for bookkeeper auth plugin
+# bookkeeperClientAuthenticationParameters:
+
+
# pulsar topics used for function metadata management
pulsarFunctionsNamespace: public/functions
diff --git a/deployment/terraform-ansible/templates/functions_worker.yml b/deployment/terraform-ansible/templates/functions_worker.yml
index 100d467..cb49ef8 100644
--- a/deployment/terraform-ansible/templates/functions_worker.yml
+++ b/deployment/terraform-ansible/templates/functions_worker.yml
@@ -36,6 +36,15 @@ downloadDirectory: /tmp/pulsar_functions
processContainerFactory:
logDirectory:
+# Bookie Authentication
+#
+# Authentication plugin to use when connecting to bookies
+# bookkeeperClientAuthenticationPlugin:
+# BookKeeper auth plugin implementatation specifics parameters name and values
+# bookkeeperClientAuthenticationParametersName:
+# Parameters for bookkeeper auth plugin
+# bookkeeperClientAuthenticationParameters:
+
schedulerClassName: "org.apache.pulsar.functions.worker.scheduler.RoundRobinScheduler"
functionAssignmentTopicName: "assignments"
failureCheckFreqMs: 30000
diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/Utils.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/Utils.java
index 3c1fa4c..b6567a6 100644
--- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/Utils.java
+++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/Utils.java
@@ -149,6 +149,14 @@ public final class Utils {
.setUseDaemonThread(true);
conf.setProperty("bkc.allowShadedLedgerManagerFactoryClass", true);
conf.setProperty("bkc.shadedLedgerManagerFactoryClassPrefix", "dlshade.");
+ if (isNotBlank(workerConfig.getBookkeeperClientAuthenticationPlugin())) {
+ conf.setProperty("bkc.clientAuthProviderFactoryClass",
+ workerConfig.getBookkeeperClientAuthenticationPlugin());
+ if (isNotBlank(workerConfig.getBookkeeperClientAuthenticationParametersName())) {
+ conf.setProperty("bkc." + workerConfig.getBookkeeperClientAuthenticationParametersName(),
+ workerConfig.getBookkeeperClientAuthenticationParameters());
+ }
+ }
return conf;
}
diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java
index 7404718..cd21a18 100644
--- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java
+++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerConfig.java
@@ -206,6 +206,21 @@ public class WorkerConfig implements Serializable, PulsarConfiguration {
)
private String clientAuthenticationParameters;
@FieldContext(
+ category = CATEGORY_CLIENT_SECURITY,
+ doc = "Authentication plugin to use when connecting to bookies"
+ )
+ private String bookkeeperClientAuthenticationPlugin;
+ @FieldContext(
+ category = CATEGORY_CLIENT_SECURITY,
+ doc = "BookKeeper auth plugin implementatation specifics parameters name and values"
+ )
+ private String bookkeeperClientAuthenticationParametersName;
+ @FieldContext(
+ category = CATEGORY_CLIENT_SECURITY,
+ doc = "Parameters for bookkeeper auth plugin"
+ )
+ private String bookkeeperClientAuthenticationParameters;
+ @FieldContext(
category = CATEGORY_FUNC_METADATA_MNG,
doc = "Frequency how often worker performs compaction on function-topics, in seconds"
)