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

Add ZOOKEEPER_HOSTS as an optional property #5435

Merged
merged 3 commits into from
Sep 15, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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("")) {
Copy link
Member Author

Choose a reason for hiding this comment

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

It will make sure zookeeper hosts are configured when the ID assignor is used.

abort(s"Must provide valid zookeeper host and port to use dynamicId assignment (${config.zookeeperHosts})")
}
new InstanceIdAssigner(config.zookeeperHosts).setAndGetId(unique, overwriteId)
Expand Down
Loading