From 4a78fc4be14c7d28007b84a60f68aef351c07517 Mon Sep 17 00:00:00 2001 From: Sandeep Agarwalla Date: Sun, 15 Oct 2023 16:56:24 +0530 Subject: [PATCH] Simplifying the config code --- .../coordinator/v2/FiloDbClusterDiscovery.scala | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/coordinator/src/main/scala/filodb/coordinator/v2/FiloDbClusterDiscovery.scala b/coordinator/src/main/scala/filodb/coordinator/v2/FiloDbClusterDiscovery.scala index 0aa54e7562..478fdb76d3 100644 --- a/coordinator/src/main/scala/filodb/coordinator/v2/FiloDbClusterDiscovery.scala +++ b/coordinator/src/main/scala/filodb/coordinator/v2/FiloDbClusterDiscovery.scala @@ -72,25 +72,20 @@ class FiloDbClusterDiscovery(settings: FilodbSettings, lazy private val hostNames = { require(settings.minNumNodes.isDefined, "[ClusterV2] Minimum Number of Nodes config not provided") - if (settings.k8sHostFormat.isDefined) { + if (settings.k8sHostFormat.isDefined && settings.akkaPort.isDefined) { // This is used in kubernetes setup. We read the host format config and resolve the FQDN using env variables val hosts = (0 until settings.minNumNodes.get) .map(i => { val currentHostname = String.format( settings.k8sHostFormat.get, - sys.env("PLATFORM_APPLICATION_ID"), - i.toString, - sys.env("PLATFORM_APPLICATION_ID"), - sys.env("K8S_NAMESPACE"), - sys.env("K8S_CLUSTER_NAME"), + i.toString ) - s"${currentHostname}:${settings.akkaPort}" + s"${currentHostname}:${settings.akkaPort.get}" }) logger.info(s"[ClusterV2] hosts to communicate: " + hosts) hosts.sorted } else if (settings.hostList.isDefined) { // All the required hosts are provided manually in the config. usually used for local runs/setup - logger.info(s"[ClusterV2] hosts to communicate: ${settings.hostList.get}") settings.hostList.get.sorted // sort to make order consistent on all nodes of cluster } else throw new IllegalArgumentException("[ClusterV2] Cluster Discovery mechanism not defined") }