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

Kubernetes Service Discovery Custom Settings #313

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -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))
shakeeb-upstart marked this conversation as resolved.
Show resolved Hide resolved

private val log = Logging(system, getClass)(LogSource.fromClass)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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")

Expand Down
Loading