Skip to content

Commit

Permalink
[pulsar-function] support bookie authentication from function-worker (a…
Browse files Browse the repository at this point in the history
…pache#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.
  • Loading branch information
rdhabalia authored and sijie committed Apr 22, 2019
1 parent 8b1c338 commit f81a711
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
10 changes: 10 additions & 0 deletions conf/functions_worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,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
Expand Down
9 changes: 9 additions & 0 deletions deployment/terraform-ansible/templates/functions_worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,21 @@ public class WorkerConfig implements Serializable, PulsarConfiguration {
doc = "The parameters of the authentication plugin used by function workers to talk to brokers"
)
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ public static DistributedLogConfiguration getDlogConf(WorkerConfig workerConfig)
.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;
}

Expand Down

0 comments on commit f81a711

Please sign in to comment.