You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by st...@apache.org on 2023/09/15 09:06:22 UTC
[openwhisk] branch master updated: Add ZOOKEEPER_HOSTS as an optional property (#5435)
This is an automated email from the ASF dual-hosted git repository.
style95 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 6375c9606 Add ZOOKEEPER_HOSTS as an optional property (#5435)
6375c9606 is described below
commit 6375c96066ca0e24cb81996a877bdd7caecdb72b
Author: Dominic Kim <st...@apache.org>
AuthorDate: Fri Sep 15 18:06:14 2023 +0900
Add ZOOKEEPER_HOSTS as an optional property (#5435)
* Add ZOOKEEPER_HOSTS as an optional property
* Check if zookeeper hosts are empty
* Apply scalaFmt
---
.../src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala b/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala
index 1d31175c1..1eeb65c16 100644
--- a/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala
+++ b/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/Invoker.scala
@@ -93,6 +93,8 @@ object Invoker {
kafkaHosts ++
wskApiHost
+ def optionalProperties = zookeeperHosts.keys.toSet
+
def initKamon(instance: Int): Unit = {
// Replace the hostname of the invoker to the assigned id of the invoker.
val newKamonConfig = Kamon.config
@@ -128,7 +130,7 @@ object Invoker {
}
// load values for the required properties from the environment
- implicit val config = new WhiskConfig(requiredProperties)
+ implicit val config = new WhiskConfig(requiredProperties, optionalProperties)
def abort(message: String) = {
logger.error(this, message)(TransactionId.invoker)
@@ -186,7 +188,8 @@ object Invoker {
// --uniqueName is defined with a valid value, id is empty, assign an id via zookeeper
case CmdLineArgs(Some(unique), None, _, overwriteId) =>
- if (config.zookeeperHosts.startsWith(":") || config.zookeeperHosts.endsWith(":")) {
+ if (config.zookeeperHosts.startsWith(":") || config.zookeeperHosts.endsWith(":") ||
+ config.zookeeperHosts.equals("")) {
abort(s"Must provide valid zookeeper host and port to use dynamicId assignment (${config.zookeeperHosts})")
}
new InstanceIdAssigner(config.zookeeperHosts).setAndGetId(unique, overwriteId)