diff --git a/envoy-control-runner/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/infrastructure/ControlPlaneConfig.kt b/envoy-control-runner/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/infrastructure/ControlPlaneConfig.kt index 6845fcb5a..2edc8b4da 100644 --- a/envoy-control-runner/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/infrastructure/ControlPlaneConfig.kt +++ b/envoy-control-runner/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/infrastructure/ControlPlaneConfig.kt @@ -27,6 +27,7 @@ import pl.allegro.tech.servicemesh.envoycontrol.consul.services.ConsulServiceCha import pl.allegro.tech.servicemesh.envoycontrol.consul.services.ConsulServiceMapper import pl.allegro.tech.servicemesh.envoycontrol.consul.services.NoOpServiceWatchPolicy import pl.allegro.tech.servicemesh.envoycontrol.consul.services.ServiceWatchPolicy +import pl.allegro.tech.servicemesh.envoycontrol.logger import pl.allegro.tech.servicemesh.envoycontrol.server.NoopReadinessStateHandler import pl.allegro.tech.servicemesh.envoycontrol.server.ReadinessStateHandler import pl.allegro.tech.servicemesh.envoycontrol.services.ClusterStateChanges @@ -49,6 +50,10 @@ class ControlPlaneConfig { Schedulers.enableMetrics() } + companion object { + private val logger by logger() + } + @Bean @ConfigurationProperties("envoy-control") fun envoyControlProperties() = EnvoyControlProperties() @@ -168,8 +173,10 @@ class ControlPlaneConfig { return EnvoyHttpFilters.defaultFilters(properties.envoy.snapshot) } - fun localDatacenter(properties: ConsulProperties) = - ConsulClient(properties.host, properties.port).agentSelf.value?.config?.datacenter ?: "local" + fun localDatacenter(properties: ConsulProperties): String { + return (ConsulClient(properties.host, properties.port).agentSelf.value?.config?.datacenter ?: "local") + .also { logger.info("Resolved local datacenter name: $it") } + } fun controlPlaneMetrics(meterRegistry: MeterRegistry) = DefaultEnvoyControlMetrics(meterRegistry = meterRegistry).also {