com.codacy.scoobydoo.kubernetes.handlers.FindPodByLabelHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scooby-doo-fwk Show documentation
Show all versions of scooby-doo-fwk Show documentation
Automated testing framework
package com.codacy.scoobydoo.kubernetes.handlers;
import io.fabric8.kubernetes.api.model.PodList;
import io.fabric8.kubernetes.client.KubernetesClient;
import java.util.concurrent.Callable;
public class FindPodByLabelHandler implements Callable {
private final KubernetesClient kubernetesClient;
private final String labelKey;
private final String labelValue;
private final String namespace;
public FindPodByLabelHandler(KubernetesClient kubernetesClient, String labelKey, String labelValue, String namespace) {
this.kubernetesClient = kubernetesClient;
this.labelKey = labelKey;
this.labelValue = labelValue;
this.namespace = namespace;
}
@Override
public Boolean call() {
PodList list = kubernetesClient
.pods()
.inNamespace(namespace)
.withLabel(labelKey, labelValue)
.list();
return !list.getItems().isEmpty();
}
}