io.kubernetes.client.models.V1PodList Java Examples
The following examples show how to use
io.kubernetes.client.models.V1PodList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: K8sSubmitter.java From submarine with Apache License 2.0 | 6 votes |
@Override public ExperimentLog getExperimentLogName(ExperimentSpec spec, String id) { ExperimentLog experimentLog = new ExperimentLog(); experimentLog.setExperimentId(id); try { final V1PodList podList = coreApi.listNamespacedPod( spec.getMeta().getNamespace(), "false", null, null, getJobLabelSelector(spec), null, null, null, null); for (V1Pod pod: podList.getItems()) { String podName = pod.getMetadata().getName(); experimentLog.addPodLog(podName, null); } } catch (final ApiException e) { LOG.error("Error when listing pod for experiment:" + spec.getMeta().getName(), e.getMessage()); } return experimentLog; }
Example #2
Source File: K8sSubmitter.java From submarine with Apache License 2.0 | 6 votes |
@Override public ExperimentLog getExperimentLog(ExperimentSpec spec, String id) { ExperimentLog experimentLog = new ExperimentLog(); experimentLog.setExperimentId(id); try { final V1PodList podList = coreApi.listNamespacedPod( spec.getMeta().getNamespace(), "false", null, null, getJobLabelSelector(spec), null, null, null, null); for (V1Pod pod : podList.getItems()) { String podName = pod.getMetadata().getName(); String namespace = pod.getMetadata().getNamespace(); String podLog = coreApi.readNamespacedPodLog( podName, namespace, null, Boolean.FALSE, Integer.MAX_VALUE, null, Boolean.FALSE, Integer.MAX_VALUE, null, Boolean.FALSE); experimentLog.addPodLog(podName, podLog); } } catch (final ApiException e) { LOG.error("Error when listing pod for experiment:" + spec.getMeta().getName(), e.getMessage()); } return experimentLog; }
Example #3
Source File: KubernetesSpyConsumer.java From HolandaCatalinaFw with Apache License 2.0 | 6 votes |
/** * This method is called periodically indicating all the current pod instances into the kubernetes cluster. * @param podList List of current pods. */ public final void updatePods(V1PodList podList) { Log.d(SystemProperties.get(SystemProperties.Net.KubernetesSpy.LOG_TAG), "Starting update pods process"); Set<String> ids = new HashSet<>(); ids.addAll(pods.keySet()); for(V1Pod pod : podList.getItems()) { if(!ids.remove(pod.getMetadata().getUid())) { Log.d(SystemProperties.get(SystemProperties.Net.KubernetesSpy.LOG_TAG), "New pod founded: %s", pod.getMetadata().getUid()); pods.put(pod.getMetadata().getUid(), pod); if(podMatcher.match(pod)) { Log.d(SystemProperties.get(SystemProperties.Net.KubernetesSpy.LOG_TAG), "Adding new pod: %s", pod.getMetadata().getUid()); onPodDiscovery(pod); } } } for(String uid : ids) { onPodLost(pods.remove(uid)); } }
Example #4
Source File: KubernetesOperation.java From k8s-Azure-Container-Service-AKS--on-Azure with MIT License | 5 votes |
/** * List all pod names in all namespaces in k8s cluster * * @return * @throws ApiException */ public List<String> getPods() throws ApiException { V1PodList v1podList = corev1Api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null); List<String> podList = v1podList.getItems() .stream() .map(v1Pod -> v1Pod.getMetadata().getName()) .collect(Collectors.toList()); return podList; }