Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using the hostname config
Browse files Browse the repository at this point in the history
sandeep6189 committed Oct 12, 2023
1 parent 40386df commit 0c6d669
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -73,12 +73,18 @@ class FiloDbClusterDiscovery(settings: FilodbSettings,
lazy private val hostNames = {
require(settings.minNumNodes.isDefined, "[ClusterV2] Minimum Number of Nodes config not provided")
if (settings.k8sHostFormat.isDefined) {
// This is used in kubernetes setup. We read the host format config and resolve the IP address from each host
// 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 resolvedIp = InetAddress.getByName(String.format(settings.k8sHostFormat.get, i.toString))
// return resolvedIpAddress and port combination for akka communication
s"${resolvedIp.getHostAddress()}:${settings.akkaPort}"
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"),
)
s"${currentHostname}:${settings.akkaPort}"
})
logger.info(s"[ClusterV2] hosts to communicate: " + hosts)
hosts.sorted

0 comments on commit 0c6d669

Please sign in to comment.