diff --git a/discovery-azure-api/src/main/scala/akka/discovery/azureapi/rbac/aks/AzureRbacAksServiceDiscovery.scala b/discovery-azure-api/src/main/scala/akka/discovery/azureapi/rbac/aks/AzureRbacAksServiceDiscovery.scala index c4a9ab8e..f9a9fe47 100644 --- a/discovery-azure-api/src/main/scala/akka/discovery/azureapi/rbac/aks/AzureRbacAksServiceDiscovery.scala +++ b/discovery-azure-api/src/main/scala/akka/discovery/azureapi/rbac/aks/AzureRbacAksServiceDiscovery.scala @@ -209,7 +209,7 @@ final class AzureRbacAksServiceDiscovery(implicit system: ExtendedActorSystem) e val host = settings.apiServiceHost val port = settings.apiServicePort val path = Uri.Path.Empty / "api" / "v1" / "namespaces" / namespace / "pods" - val query = Uri.Query("labelSelector" -> labelSelector) + val query = Uri.Query("labelSelector" -> labelSelector, "fieldSelector" -> "status.phase==Running") val uri = Uri.from(scheme = "https", host = host, port = port).withPath(path).withQuery(query) Future(HttpRequest(uri = uri, headers = List(Authorization(OAuth2BearerToken(token))))) 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 f56da4f5..69ee2061 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 @@ -221,7 +221,7 @@ class KubernetesApiServiceDiscovery(implicit system: ActorSystem) extends Servic port <- Try(portStr.toInt).toOption } yield { val path = Uri.Path.Empty / "api" / "v1" / "namespaces" / namespace / "pods" - val query = Uri.Query("labelSelector" -> labelSelector) + val query = Uri.Query("labelSelector" -> labelSelector, "fieldSelection" -> "status.phase==Running") val uri = Uri.from(scheme = "https", host = host, port = port).withPath(path).withQuery(query) HttpRequest(uri = uri, headers = List(Authorization(OAuth2BearerToken(token))))