Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pulsar Functions] Support config admin CLI in funtions runtime #6681

Merged
merged 2 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ pulsar-broker/tmp.*
pulsar-broker/src/test/resources/log4j2.yaml
pulsar-functions/worker/test-tenant/
pulsar-broker/src/test/resources/pulsar-functions-api-examples.jar
pulsar-functions/runtime/src/test/resources/
pulsar-functions/worker/src/test/resources/
*.log
*.nar

Expand Down
3 changes: 3 additions & 0 deletions conf/functions_worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ functionRuntimeFactoryConfigs:
# ram: 1073741824
# disk: 10737418240

## Config admin CLI
#configAdminCLI:
Comment on lines +163 to +164
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks duplicated.


############################################
# security settings for worker service
############################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public class KubernetesRuntime implements Runtime {
private final String pulsarDockerImageName;
private final String imagePullPolicy;
private final String pulsarRootDir;
private final String configAdminCLI;
private final String userCodePkgUrl;
private final String originalCodeFileName;
private final String pulsarAdminUrl;
Expand Down Expand Up @@ -160,6 +161,7 @@ public class KubernetesRuntime implements Runtime {
String instanceFile,
String extraDependenciesDir,
String logDirectory,
String configAdminCLI,
String userCodePkgUrl,
String originalCodeFileName,
String pulsarServiceUrl,
Expand All @@ -184,6 +186,7 @@ public class KubernetesRuntime implements Runtime {
this.pulsarDockerImageName = pulsarDockerImageName;
this.imagePullPolicy = imagePullPolicy;
this.pulsarRootDir = pulsarRootDir;
this.configAdminCLI = configAdminCLI;
this.userCodePkgUrl = userCodePkgUrl;
this.originalCodeFileName = pulsarRootDir + "/" + originalCodeFileName;
this.pulsarAdminUrl = pulsarAdminUrl;
Expand Down Expand Up @@ -804,7 +807,7 @@ private List<String> getDownloadCommand(String tenant, String namespace, String
&& isNotBlank(authConfig.getClientAuthenticationParameters())
&& instanceConfig.getFunctionAuthenticationSpec() != null) {
return Arrays.asList(
pulsarRootDir + "/bin/pulsar-admin",
pulsarRootDir + configAdminCLI,
"--auth-plugin",
authConfig.getClientAuthenticationPlugin(),
"--auth-params",
Expand All @@ -825,7 +828,7 @@ && isNotBlank(authConfig.getClientAuthenticationParameters())
}

return Arrays.asList(
pulsarRootDir + "/bin/pulsar-admin",
pulsarRootDir + configAdminCLI,
"--admin-url",
pulsarAdminUrl,
"functions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class KubernetesRuntimeFactory implements RuntimeFactory {
private String pulsarDockerImageName;
private String imagePullPolicy;
private String pulsarRootDir;
private String configAdminCLI;
private String pulsarAdminUrl;
private String pulsarServiceUrl;
private String pythonDependencyRepository;
Expand Down Expand Up @@ -151,6 +152,11 @@ public void initialize(WorkerConfig workerConfig, AuthenticationConfig authentic
} else {
this.pulsarRootDir = "/pulsar";
}
if (!isEmpty(factoryConfig.getConfigAdminCLI())) {
this.configAdminCLI = factoryConfig.getConfigAdminCLI();
} else {
this.configAdminCLI = "/bin/pulsar-admin";
}

this.submittingInsidePod = factoryConfig.getSubmittingInsidePod();
this.installUserCodeDependencies = factoryConfig.getInstallUserCodeDependencies();
Expand Down Expand Up @@ -270,6 +276,7 @@ public KubernetesRuntime createContainer(InstanceConfig instanceConfig, String c
instanceFile,
extraDependenciesDir,
logDirectory,
configAdminCLI,
codePkgUrl,
originalCodeFileName,
pulsarServiceUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public class KubernetesRuntimeFactoryConfig {
+ " customized image in `pulsarDockerImageName`, you need to set this setting accordingly"
)
protected String pulsarRootDir;
@FieldContext(
doc = "The config admin CLI allows users to customize the configuration of the admin cli tool, such as:"
+ " `/bin/pulsar-admin and /bin/pulsarctl`. By default it is `/bin/pulsar-admin`. If you want to use `pulsarctl` "
+ " you need to set this setting accordingly"
)
protected String configAdminCLI;
@FieldContext(
doc = "This setting only takes effects if `k8Uri` is set to null. If your function worker is"
+ " also running as a k8s pod, set this to `true` is let function worker to submit functions to"
Expand Down