for (Pod pod : list.getItems()) {
public void run() { PodList podList = listSelectedPods(obj); int count = 0; List<Pod> items = podList.getItems(); for (Pod item : items) { for (PodCondition c : item.getStatus().getConditions()) { if (c.getType().equals("Ready") && c.getStatus().equals("True")) { count++; } } } podCount.set(count); if (count == requiredPodCount) { countDownLatch.countDown(); } } };
public Optional<Reader> streamLogs(String label, String integrationName) { return client.pods().list().getItems().stream() .filter(p -> integrationName.equals(p.getMetadata().getLabels().get(label))).findAny(). flatMap(p -> //Optional.of(client.pods().inNamespace(config.getNamespace()).withName(p.getMetadata().getName()).getLogReader()) Optional.of(new StringReader("REQUIRES_LIBRARY_UPDATE!!!!")) ); }
public Collection<String> getIntegrationPods() { return client.pods().list().getItems().stream() .filter(pod -> pod.getMetadata().getLabels().containsKey("integration")) .map(pod -> pod.getMetadata().getLabels().get("integration")) .collect(Collectors.toList()); }
protected void doList(Exchange exchange, String operation) throws Exception { PodList podList = getEndpoint().getKubernetesClient().pods().inAnyNamespace().list(); MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); exchange.getOut().setBody(podList.getItems()); }
private Pod getNewestPod(LabelSelector selector) { FilterWatchListDeletable<Pod, PodList, Boolean, Watch, Watcher<Pod>> pods = KubernetesClientUtil.withSelector(kubernetes.pods(), selector, log); PodList list = pods.list(); if (list != null) { List<Pod> items = list.getItems(); return getNewestPod(items); } return null; }
@Override public List<Pod> getAllPods(String kubeName, String namespace) throws RepositoryException { final KubernetesClient client = kubeRepository.getClient(kubeName); final PodList list = client.pods().inNamespace(namespace).list(); return list.getItems(); }
for (Pod pod : oldPods.getItems()) { try { pods().inNamespace(namespace).withName(pod.getMetadata().getName())
log("Created pods:", client.pods().inNamespace("thisisatest").list().getItems()); client.deploymentConfigs().inNamespace("thisisatest").withName("nginx").delete(); log("Pods:", client.pods().inNamespace("thisisatest").list().getItems()); log("Replication Controllers:", client.replicationControllers().inNamespace("thisisatest").list().getItems());
/** * Returns a client for the first working pod for the given service */ public J4pClient clientForService(String serviceName) { List<Pod> pods = KubernetesHelper.getPodsForService(requireService(serviceName), kubernetes.pods().list().getItems()); return clientForPod(pods); }
private static List<String> print(FilterWatchListDeletable<Pod, PodList, Boolean, Watch, Watcher<Pod>> pods) { return pods.list().getItems().stream() .map(pod -> String.format("%s (%s)", pod.getMetadata().getName(), pod.getStatus().getPhase())) .collect(Collectors.toList()); } }
/** * Returns all the clients for the first working pod for the given replication controller */ public List<J4pClient> clientsForReplicationController(String replicationControllerName, String namespace) { ReplicationController replicationController = requireReplicationController(replicationControllerName, namespace); List<Pod> pods = KubernetesHelper.getPodsForReplicationController(replicationController, kubernetes.pods().inNamespace(namespace).list().getItems()); return clientsForPod(pods); }
/** * Returns a client for the first working pod for the given service */ public J4pClient clientForService(String serviceName, String namespace) { List<Pod> pods = KubernetesHelper.getPodsForService(requireService(serviceName, namespace), kubernetes.pods().inNamespace(namespace).list().getItems()); return clientForPod(pods); }
/** * Returns all the clients for the first working pod for the given service */ public List<J4pClient> clientsForService(String serviceName, String namespace) { List<Pod> pods = KubernetesHelper.getPodsForService(requireService(serviceName, namespace), kubernetes.pods().inNamespace(namespace).list().getItems()); return clientsForPod(pods); }
public PodListBuilder(PodList instance,Boolean validationEnabled){ this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withItems(instance.getItems()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); this.validationEnabled = validationEnabled; }
public PodListFluentImpl(PodList instance){ this.withApiVersion(instance.getApiVersion()); this.withItems(instance.getItems()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); }
/** * Returns all the clients the first working pod for the given service */ public List<J4pClient> clientsForService(Service service) { List<Pod> pods = KubernetesHelper.getPodsForService(service, kubernetes.pods().inNamespace(service.getMetadata().getNamespace()).list().getItems()); return clientsForPod(pods); }
public PodListBuilder(PodListFluent<?> fluent,PodList instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withItems(instance.getItems()); fluent.withKind(instance.getKind()); fluent.withMetadata(instance.getMetadata()); this.validationEnabled = validationEnabled; } public PodListBuilder(PodList instance){
public static void displaySessionStatus(KubernetesClient client, Session session) throws MultiException { for (ReplicationController replicationController : client.getReplicationControllers(session.getNamespace()).getItems()) { session.getLogger().info("Replication controller:" + getId(replicationController)); } for (Pod pod : client.getPods(session.getNamespace()).getItems()) { session.getLogger().info("Pod:" + getId(pod) + " Status:" + pod.getCurrentState().getStatus()); } for (Service service : client.getServices(session.getNamespace()).getItems()) { session.getLogger().info("Service:" + getId(service) + " IP:" + getPortalIP(service) + " Port:" + getPort(service)); } }