From 94c8c153e7b00e5980170d88bb4d5b9ca45bb34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Andr=C3=A9n?= Date: Mon, 18 Dec 2023 15:08:30 +0100 Subject: [PATCH] fix: Migrate to kubernetes svc DNS names from the deprecated pod DNS names Naive search replace to see what breaks in CI --- .../bootstrap/LowestAddressJoinDeciderSpec.scala | 12 ++++++------ .../kubernetes/KubernetesApiServiceDiscovery.scala | 2 +- .../KubernetesApiServiceDiscoverySpec.scala | 10 +++++----- .../main/paradox/kubernetes-deployment/deploying.md | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cluster-bootstrap/src/test/scala/akka/management/cluster/bootstrap/LowestAddressJoinDeciderSpec.scala b/cluster-bootstrap/src/test/scala/akka/management/cluster/bootstrap/LowestAddressJoinDeciderSpec.scala index 594e5c91f..dcc989357 100644 --- a/cluster-bootstrap/src/test/scala/akka/management/cluster/bootstrap/LowestAddressJoinDeciderSpec.scala +++ b/cluster-bootstrap/src/test/scala/akka/management/cluster/bootstrap/LowestAddressJoinDeciderSpec.scala @@ -53,17 +53,17 @@ abstract class JoinDeciderSpec extends AbstractBootstrapSpec { """) val contactA = ResolvedTarget( - host = "10-0-0-2.default.pod.cluster.local", + host = "10-0-0-2.default.svc.cluster.local", port = None, address = Some(InetAddress.getByName("10.0.0.2"))) val contactB = ResolvedTarget( - host = "10-0-0-3.default.pod.cluster.local", + host = "10-0-0-3.default.svc.cluster.local", port = None, address = Some(InetAddress.getByName("10.0.0.3"))) val contactC = ResolvedTarget( - host = "10-0-0-4.default.pod.cluster.local", + host = "10-0-0-4.default.svc.cluster.local", port = None, address = Some(InetAddress.getByName("10.0.0.4"))) @@ -306,17 +306,17 @@ class SelfAwareJoinDeciderIPv6Spec extends JoinDeciderSpec { val settings = ClusterBootstrapSettings(system.settings.config, NoLogging) val contactIPv6A = ResolvedTarget( - host = "240b-c0e0-202-5e2b-b424-2-0-450.default.pod.cluster.local", + host = "240b-c0e0-202-5e2b-b424-2-0-450.default.svc.cluster.local", port = None, address = Some(InetAddress.getByName("240b:c0e0:202:5e2b:b424:2:0:450"))) val contactIPv6B = ResolvedTarget( - host = "240b-c0e0-202-5e2b-b424-2-0-cc4.default.pod.cluster.local", + host = "240b-c0e0-202-5e2b-b424-2-0-cc4.default.svc.cluster.local", port = None, address = Some(InetAddress.getByName("240b:c0e0:202:5e2b:b424:2:0:cc4"))) val contactIPv6C = ResolvedTarget( - host = "240b-c0e0-202-5e2b-b424-2-0-cc5.default.pod.cluster.local", + host = "240b-c0e0-202-5e2b-b424-2-0-cc5.default.svc.cluster.local", port = None, address = Some(InetAddress.getByName("240b:c0e0:202:5e2b:b424:2:0:cc5"))) diff --git a/discovery-kubernetes-api/src/main/scala/akka/discovery/kubernetes/KubernetesApiServiceDiscovery.scala b/discovery-kubernetes-api/src/main/scala/akka/discovery/kubernetes/KubernetesApiServiceDiscovery.scala index fcdb11696..6a598e17a 100644 --- a/discovery-kubernetes-api/src/main/scala/akka/discovery/kubernetes/KubernetesApiServiceDiscovery.scala +++ b/discovery-kubernetes-api/src/main/scala/akka/discovery/kubernetes/KubernetesApiServiceDiscovery.scala @@ -79,7 +79,7 @@ object KubernetesApiServiceDiscovery { } yield Some(port.containerPort) } } yield { - val hostOrIp = if (rawIp) ip else s"${ip.replace('.', '-')}.$podNamespace.pod.$podDomain" + val hostOrIp = if (rawIp) ip else s"${ip.replace('.', '-')}.$podNamespace.svc.$podDomain" ResolvedTarget( host = hostOrIp, port = maybePort, diff --git a/discovery-kubernetes-api/src/test/scala/akka/discovery/kubernetes/KubernetesApiServiceDiscoverySpec.scala b/discovery-kubernetes-api/src/test/scala/akka/discovery/kubernetes/KubernetesApiServiceDiscoverySpec.scala index caa00685f..d283561a7 100644 --- a/discovery-kubernetes-api/src/test/scala/akka/discovery/kubernetes/KubernetesApiServiceDiscoverySpec.scala +++ b/discovery-kubernetes-api/src/test/scala/akka/discovery/kubernetes/KubernetesApiServiceDiscoverySpec.scala @@ -46,7 +46,7 @@ class KubernetesApiServiceDiscoverySpec extends AnyWordSpec with Matchers { KubernetesApiServiceDiscovery.targets(podList, Some("management"), "default", "cluster.local", false, None) shouldBe List( ResolvedTarget( - host = "172-17-0-4.default.pod.cluster.local", + host = "172-17-0-4.default.svc.cluster.local", port = Some(10001), address = Some(InetAddress.getByName("172.17.0.4")) )) @@ -112,17 +112,17 @@ class KubernetesApiServiceDiscoverySpec extends AnyWordSpec with Matchers { KubernetesApiServiceDiscovery.targets(podList, None, "default", "cluster.local", false, None) shouldBe List( ResolvedTarget( - host = "172-17-0-4.default.pod.cluster.local", + host = "172-17-0-4.default.svc.cluster.local", port = None, address = Some(InetAddress.getByName("172.17.0.4")) ), ResolvedTarget( - host = "172-17-0-5.default.pod.cluster.local", + host = "172-17-0-5.default.svc.cluster.local", port = None, address = Some(InetAddress.getByName("172.17.0.5")) ), ResolvedTarget( - host = "172-17-0-6.default.pod.cluster.local", + host = "172-17-0-6.default.svc.cluster.local", port = None, address = Some(InetAddress.getByName("172.17.0.6")) ) @@ -170,7 +170,7 @@ class KubernetesApiServiceDiscoverySpec extends AnyWordSpec with Matchers { false, Some("user-function")) shouldBe List( ResolvedTarget( - "10-8-7-9.b58dbc88-3651-4fb4-8408-60c375592d1d.pod.cluster.local", + "10-8-7-9.b58dbc88-3651-4fb4-8408-60c375592d1d.svc.cluster.local", None, Some(InetAddress.getByName("10.8.7.9"))) ) diff --git a/docs/src/main/paradox/kubernetes-deployment/deploying.md b/docs/src/main/paradox/kubernetes-deployment/deploying.md index fe2a278fe..2b393d4c5 100644 --- a/docs/src/main/paradox/kubernetes-deployment/deploying.md +++ b/docs/src/main/paradox/kubernetes-deployment/deploying.md @@ -81,7 +81,7 @@ make the logs quieter, but for now it will help us to understand what is happeni [INFO] [akka.management.cluster.bootstrap.internal.BootstrapCoordinator] [] [Appka-akka.actor.default-dispatcher-3] - Looking up [Lookup(appka,None,Some(tcp))] MDC: {akkaAddress=akka://Appka@172.17.0.6:25520, sourceThread=Appka-akka.actor.default-dispatcher-13, akkaSource=akka://Appka/system/bootstrapCoordinator, sourceActorSystem=Appka, akkaTimestamp=10:04:53.844UTC} [INFO] [akka.discovery.kubernetes.KubernetesApiServiceDiscovery] [] [Appka-akka.actor.default-dispatcher-3] - Querying for pods with label selector: [app=appka]. Namespace: [appka-1]. Port: [None] MDC: {akkaAddress=akka://Appka@172.17.0.6:25520, sourceThread=Appka-akka.actor.default-dispatcher-13, akkaSource=KubernetesApiServiceDiscovery(akka://Appka), sourceActorSystem=Appka, akkaTimestamp=10:04:53.844UTC} -5 [INFO] [akka.management.cluster.bootstrap.internal.BootstrapCoordinator] [akkaBootstrapResolved] [Appka-akka.actor.default-dispatcher-3] - Located service members based on: [Lookup(appka,None,Some(tcp))]: [ResolvedTarget(172-17-0-6.appka-1.pod.cluster.local,None,Some(/172.17.0.6)), ResolvedTarget(172-17-0-7.appka-1.pod.cluster.local,None,Some(/172.17.0.7)), ResolvedTarget(172-17-0-5.appka-1.pod.cluster.local,None,Some(/172.17.0.5))], filtered to [172-17-0-5.appka-1.pod.cluster.local:0, 172-17-0-6.appka-1.pod.cluster.local:0, 172-17-0-7.appka-1.pod.cluster.local:0] MDC: {akkaAddress=akka://Appka@172.17.0.6:25520, akkaContactPoints=172-17-0-5.appka-1.pod.cluster.local:0, 172-17-0-6.appka-1.pod.cluster.local:0, 172-17-0-7.appka-1.pod.cluster.local:0, sourceThread=Appka-akka.actor.default-dispatcher-13, akkaSource=akka://Appka/system/bootstrapCoordinator, sourceActorSystem=Appka, akkaTimestamp=10:04:54.919UTC} +5 [INFO] [akka.management.cluster.bootstrap.internal.BootstrapCoordinator] [akkaBootstrapResolved] [Appka-akka.actor.default-dispatcher-3] - Located service members based on: [Lookup(appka,None,Some(tcp))]: [ResolvedTarget(172-17-0-6.appka-1.svc.cluster.local,None,Some(/172.17.0.6)), ResolvedTarget(172-17-0-7.appka-1.svc.cluster.local,None,Some(/172.17.0.7)), ResolvedTarget(172-17-0-5.appka-1.svc.cluster.local,None,Some(/172.17.0.5))], filtered to [172-17-0-5.appka-1.svc.cluster.local:0, 172-17-0-6.appka-1.svc.cluster.local:0, 172-17-0-7.appka-1.svc.cluster.local:0] MDC: {akkaAddress=akka://Appka@172.17.0.6:25520, akkaContactPoints=172-17-0-5.appka-1.svc.cluster.local:0, 172-17-0-6.appka-1.svc.cluster.local:0, 172-17-0-7.appka-1.svc.cluster.local:0, sourceThread=Appka-akka.actor.default-dispatcher-13, akkaSource=akka://Appka/system/bootstrapCoordinator, sourceActorSystem=Appka, akkaTimestamp=10:04:54.919UTC} 6 [INFO] [akka.management.cluster.bootstrap.internal.BootstrapCoordinator] [akkaBootstrapSeedNodes] [Appka-akka.actor.default-dispatcher-20] - Contact point [akka://Appka@172.17.0.5:25520] returned [1] seed-nodes [akka://Appka@172.17.0.5:25520] MDC: {akkaAddress=akka://Appka@172.17.0.6:25520, sourceThread=Appka-akka.actor.default-dispatcher-11, akkaSource=akka://Appka/system/bootstrapCoordinator, sourceActorSystem=Appka, akkaTimestamp=10:05:01.306UTC, akkaSeedNodes=akka://Appka@172.17.0.5:25520} [INFO] [akka.management.cluster.bootstrap.internal.BootstrapCoordinator] [akkaBootstrapJoin] [Appka-akka.actor.default-dispatcher-20] - Joining [akka://Appka@172.17.0.6:25520] to existing cluster [akka://Appka@172.17.0.5:25520] MDC: {akkaAddress=akka://Appka@172.17.0.6:25520, sourceThread=Appka-akka.actor.default-dispatcher-11, akkaSource=akka://Appka/system/bootstrapCoordinator, sourceActorSystem=Appka, akkaTimestamp=10:05:01.309UTC, akkaSeedNodes=akka://Appka@172.17.0.5:25520}