Skip to content
This repository was archived by the owner on May 25, 2023. It is now read-only.
This repository was archived by the owner on May 25, 2023. It is now read-only.

Change config key used for Cluster Bootstrap Discovery Method #173

@TimMoore

Description

@TimMoore

This currently sets the akka.discovery.method config setting to kubernetes-api or marathon-api, depending on the deployment target:

private[kubernetes] def akkaClusterEnvs(modules: Set[String], namespace: Option[String], serviceResourceName: String, noOfReplicas: Int, akkaClusterBootstrapSystemName: Option[String], akkaClusterJoinExisting: Boolean): Map[String, EnvironmentVariable] =
if (!modules.contains(Module.AkkaClusterBootstrapping))
Map.empty
else
Map(
"RP_JAVA_OPTS" -> LiteralEnvironmentVariable(
Seq(
s"-Dakka.discovery.method=kubernetes-api",
s"-Dakka.management.cluster.bootstrap.contact-point-discovery.effective-name=$serviceResourceName",
s"-Dakka.management.cluster.bootstrap.contact-point-discovery.required-contact-point-nr=$noOfReplicas",
akkaClusterBootstrapSystemName.fold("-Dakka.discovery.kubernetes-api.pod-label-selector=appName=%s")(systemName => s"-Dakka.discovery.kubernetes-api.pod-label-selector=actorSystemName=$systemName"),
s"${if (akkaClusterJoinExisting) "-Dakka.management.cluster.bootstrap.form-new-cluster=false" else ""}")
.filter(_.nonEmpty)
.mkString(" ")),
"RP_DYN_JAVA_OPTS" -> LiteralEnvironmentVariable(
Seq(
"-Dakka.discovery.kubernetes-api.pod-namespace=$RP_NAMESPACE")
.filter(_.nonEmpty)
.mkString(" ")))

private def akkaClusterEnvs(modules: Set[String], namespace: Option[String], serviceResourceName: String, noOfReplicas: Int, akkaClusterBootstrapSystemName: Option[String], akkaClusterJoinExisting: Boolean): Map[String, String] =
if (!modules.contains(Module.AkkaClusterBootstrapping))
Map.empty
else
Map(
"RP_JAVA_OPTS" -> Seq(
s"-Dakka.discovery.method=marathon-api",
s"-Dakka.management.cluster.bootstrap.contact-point-discovery.effective-name=$serviceResourceName",
s"-Dakka.management.cluster.bootstrap.contact-point-discovery.required-contact-point-nr=$noOfReplicas",
akkaClusterBootstrapSystemName.fold("-Dakka.discovery.marathon-api.app-label-query=APP_NAME==%s")(systemName => s"-Dakka.discovery.marathon-api.app-label-query=ACTOR_SYSTEM_NAME==$systemName"),
s"${if (akkaClusterJoinExisting) "-Dakka.management.cluster.bootstrap.form-new-cluster=false" else ""}")
.filter(_.nonEmpty)
.mkString(" "))

These globally sets the default discovery method to an implementation that is only appropriate to use for Cluster Bootstrap and not for inter-service discovery. This will cause problems for Akka gRPC users, and in the future, all Lagom users.

This should be updated to set akka.management.cluster.bootstrap.contact-point-discovery.discovery-method instead of akka.discovery.method, as described in akka/akka-management#316.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions