public final class PodWatchUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
close() |
static java.util.HashMap<java.lang.String,java.lang.String> |
discoverRunningPodIPs(java.util.ArrayList<java.lang.String> podNames,
java.lang.String namespace,
java.lang.String labelSelector,
int timeout)
watch pods until getting the Running event for all the pods in the given list
return pod names and IP addresses as a HashMap
|
static ApiClient |
getApiClient() |
static CoreV1Api |
getCoreApi() |
static java.lang.String |
getIpByWatchingPodToRunning(java.lang.String namespace,
java.lang.String podName,
int timeout)
watch the given pod until it is Running and get its IP
we assume that the pod is constructed as a StatefulSet
|
static java.lang.String |
getJobMasterIpByWatchingPodToRunning(java.lang.String namespace,
java.lang.String jobID,
int timeout)
watch the job master pod until it is Running and get its IP
we assume that the job master has the unique twister2-role label and value pair
|
static java.lang.String |
getNodeIP(java.lang.String namespace,
java.lang.String jobID,
java.lang.String podIP)
get the IP of the node where the pod with that name is running
|
static java.util.ArrayList<java.lang.String> |
getWorkerIPsByWatchingPodsToRunning(java.lang.String namespace,
java.lang.String jobID,
int numberOfPods,
int timeout)
watch the worker pods until they are Running and get their IP addresses
we assume that workers have the unique twister2-role label and value pair
we get the ip addresses of all workers including the worker pod calling this method
|
static void |
testGetPodList(java.lang.String namespace)
a test method to see whether kubernetes java client can connect to kubernetes master
and get the pod list
|
static void |
testWatchPods(java.lang.String namespace,
java.lang.String jobID,
int timeout)
test watch pods method in the worker pod
|
static boolean |
watchPodsToRunning(java.lang.String namespace,
java.lang.String jobID,
java.util.HashMap<java.lang.String,java.lang.Boolean> pods,
int timeout)
watch pods until getting the Running event for all the pods in the given map
mark each pod that reached to Running state in the given map
|
static boolean |
watchPodsToStarting(java.lang.String namespace,
java.lang.String jobID,
java.util.HashMap<java.lang.String,java.lang.Boolean> pods,
int timeout)
watch all pods in the given list until they become Starting
flag the pods with a true value in the given HashMap
|
public static CoreV1Api getCoreApi()
public static ApiClient getApiClient()
public static void close()
public static java.util.HashMap<java.lang.String,java.lang.String> discoverRunningPodIPs(java.util.ArrayList<java.lang.String> podNames, java.lang.String namespace, java.lang.String labelSelector, int timeout)
public static boolean watchPodsToRunning(java.lang.String namespace, java.lang.String jobID, java.util.HashMap<java.lang.String,java.lang.Boolean> pods, int timeout)
public static boolean watchPodsToStarting(java.lang.String namespace, java.lang.String jobID, java.util.HashMap<java.lang.String,java.lang.Boolean> pods, int timeout)
public static java.lang.String getNodeIP(java.lang.String namespace, java.lang.String jobID, java.lang.String podIP)
public static void testGetPodList(java.lang.String namespace)
public static void testWatchPods(java.lang.String namespace, java.lang.String jobID, int timeout)
public static java.lang.String getIpByWatchingPodToRunning(java.lang.String namespace, java.lang.String podName, int timeout)
public static java.lang.String getJobMasterIpByWatchingPodToRunning(java.lang.String namespace, java.lang.String jobID, int timeout)
public static java.util.ArrayList<java.lang.String> getWorkerIPsByWatchingPodsToRunning(java.lang.String namespace, java.lang.String jobID, int numberOfPods, int timeout)
getting IP addresses by list method does not work, since uninitialized pod IPs are not returned by list method
return null, if it can not get the full list