Commit b89dcff3 authored by Mathieu's avatar Mathieu
Browse files

Use withK8s

parent fa53aa78
......@@ -26,10 +26,14 @@ object K8sService {
def listPods = {
// val k8s = k8sInit
Await.result (
withK8s { k8s =>
implicit val system = ActorSystem()
implicit val materializer = ActorMaterializer()
implicit val dispatcher = system.dispatcher
val k8s = k8sInit
val allPodsMapFut: Future[Map[String, PodList]] = k8s listByNamespace[PodList]()
val allPodsFuture: Future[List[Pod]] = allPodsMapFut map { allPodsMap =>
......@@ -65,9 +69,9 @@ object K8sService {
}
}
val allPods = allPodsFuture map { pods => listPods0(pods) }
allPodsFuture map { pods => listPods0(pods) }
Await.result(allPods, Duration.Inf)
}, Duration.Inf)
}
def withK8s[T](kubeAction: KubernetesClient => Future[T]) = {
......@@ -75,9 +79,7 @@ object K8sService {
implicit val system = ActorSystem()
implicit val materializer = ActorMaterializer()
implicit val dispatcher = system.dispatcher
// val k8s = k8sInit(K8SConfiguration.useLocalProxyDefault)
val k8s = k8sInit(K8SConfiguration.useLocalProxyDefault.setCurrentNamespace("ingress-nginx"))
val k8s = k8sInit
kubeAction(k8s)
}
......@@ -127,7 +129,9 @@ object K8sService {
deployOpenMOLE(uuid)
}
private def podInfo(uuid: UUID) =
private def podInfo(uuid: UUID)
=
// import monix.execution.Scheduler.Implicits.global
listPods.find {
_.name.contains(uuid.value)
......@@ -155,4 +159,4 @@ object K8sService {
_.podIP
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment