diff --git a/discovery-kubernetes-api/src/main/scala/org/apache/pekko/discovery/kubernetes/KubernetesApiServiceDiscovery.scala b/discovery-kubernetes-api/src/main/scala/org/apache/pekko/discovery/kubernetes/KubernetesApiServiceDiscovery.scala index dd9f9631..279a28a5 100644 --- a/discovery-kubernetes-api/src/main/scala/org/apache/pekko/discovery/kubernetes/KubernetesApiServiceDiscovery.scala +++ b/discovery-kubernetes-api/src/main/scala/org/apache/pekko/discovery/kubernetes/KubernetesApiServiceDiscovery.scala @@ -96,13 +96,14 @@ object KubernetesApiServiceDiscovery { * An alternative implementation that uses the Kubernetes API. The main advantage of this method is that it allows * you to define readiness/health checks that don't affect the bootstrap mechanism. */ -class KubernetesApiServiceDiscovery(implicit system: ActorSystem) extends ServiceDiscovery { +class KubernetesApiServiceDiscovery(settings: Settings)( + implicit system: ActorSystem) extends ServiceDiscovery { import system.dispatcher private val http = Http() - private val settings = Settings(system) + def this()(implicit system: ActorSystem) = this(Settings(system)) private val log = Logging(system, getClass)(LogSource.fromClass) diff --git a/discovery-kubernetes-api/src/main/scala/org/apache/pekko/discovery/kubernetes/Settings.scala b/discovery-kubernetes-api/src/main/scala/org/apache/pekko/discovery/kubernetes/Settings.scala index 55d6af21..afbb7394 100644 --- a/discovery-kubernetes-api/src/main/scala/org/apache/pekko/discovery/kubernetes/Settings.scala +++ b/discovery-kubernetes-api/src/main/scala/org/apache/pekko/discovery/kubernetes/Settings.scala @@ -20,7 +20,9 @@ import com.typesafe.config.Config import org.apache.pekko.util.OptionConverters._ -final class Settings(system: ExtendedActorSystem) extends Extension { +final class Settings(kubernetesApi: Config) extends Extension { + + def this(system: ExtendedActorSystem) = this(system.settings.config.getConfig("pekko.discovery.kubernetes-api")) /** * Copied from PekkoManagementSettings, which we don't depend on. @@ -35,8 +37,6 @@ final class Settings(system: ExtendedActorSystem) extends Extension { if (hasDefined(key)) Some(config.getString(key)) else None } - private val kubernetesApi = system.settings.config.getConfig("pekko.discovery.kubernetes-api") - val apiCaPath: String = kubernetesApi.getString("api-ca-path")