public final class KubernetesUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
allContainersReady(java.util.List<V1ContainerStatus> contStatuses) |
static java.lang.String |
createContainerName(int containerIndex)
create container name with the given containerIndex
each container in a pod will have a unique name with this index
|
static java.lang.String[] |
createCopyCommand(java.lang.String filename,
java.lang.String namespace,
java.lang.String podName,
java.lang.String podFile)
create file copy command to a pod
|
static java.util.HashMap<java.lang.String,java.lang.String> |
createJobLabels(java.lang.String jobID)
all twister2 resources have these two labels
One is to distinguish twister2 resources from others
the other is to distinguish job resources from others
|
static java.lang.String |
createJobMasterPodName(java.lang.String jobID)
create pod name for the job master
there will be one pod for the job master
we add a suffix to statefulset name
|
static java.lang.String |
createJobMasterServiceName(java.lang.String jobID)
create service name for the job master
|
static java.lang.String |
createJobMasterStatefulSetName(java.lang.String jobID)
create StatefulSet name for the given job name
add a suffix to job name
|
static java.lang.String |
createPersistentVolumeName(java.lang.String jobID)
create storage claim name name from job name
|
static java.lang.String |
createRestartJobMasterKey()
create the key for job master restart count to be used in ConfigMap
|
static java.lang.String |
createRestartWorkerKey(int workerID)
create the key for worker restart count to be used in ConfigMap
|
static java.lang.String |
createServiceName(java.lang.String jobID)
create service name for workers
|
static java.lang.String |
createWorkersStatefulSetName(java.lang.String jobID,
int index)
create StatefulSet name for workers
add the given index a suffix to the job name
|
static java.util.ArrayList<java.lang.String> |
generatePodNames(JobAPI.Job job)
generate all pod names in a job
|
static int |
indexFromName(java.lang.String name)
when the given name is in the form of "name-index"
it returns the index as int
|
static boolean |
isPodRunning(V1Pod pod)
we assume the pod became running when:
pod phase is Running
pod deletion time stamp is null (if not null.
|
static java.lang.String |
jobLabelSelector(java.lang.String jobID) |
static java.lang.String |
jobMasterPodLabelSelector(java.lang.String jobID) |
static java.lang.String |
jobPackageFullPath(Config config,
java.lang.String jobID) |
static int |
numberOfWorkerPods(JobAPI.Job job)
calculate the number of pods in a job
|
static java.lang.String |
podNameFromStatefulSetName(java.lang.String ssName,
int podIndex)
create podName from StatefulSet name with pod index
|
static java.lang.String |
removeIndexFromName(java.lang.String name)
when the given name is in the form of "name-index"
it returns the name by removing the dash and the index
|
static java.lang.String |
twister2LabelSelector() |
static java.lang.String |
workerPodLabelSelector(java.lang.String jobID) |
public static int indexFromName(java.lang.String name)
name
- public static java.lang.String removeIndexFromName(java.lang.String name)
name
- public static java.lang.String[] createCopyCommand(java.lang.String filename, java.lang.String namespace, java.lang.String podName, java.lang.String podFile)
public static java.lang.String podNameFromStatefulSetName(java.lang.String ssName, int podIndex)
public static java.lang.String createServiceName(java.lang.String jobID)
jobID
- public static java.lang.String createJobMasterServiceName(java.lang.String jobID)
jobID
- public static java.lang.String createPersistentVolumeName(java.lang.String jobID)
jobID
- public static java.util.HashMap<java.lang.String,java.lang.String> createJobLabels(java.lang.String jobID)
jobID
- public static java.lang.String twister2LabelSelector()
public static java.lang.String jobLabelSelector(java.lang.String jobID)
public static java.lang.String jobMasterPodLabelSelector(java.lang.String jobID)
public static java.lang.String workerPodLabelSelector(java.lang.String jobID)
public static java.lang.String createContainerName(int containerIndex)
containerIndex
- public static java.lang.String createWorkersStatefulSetName(java.lang.String jobID, int index)
public static java.lang.String createJobMasterStatefulSetName(java.lang.String jobID)
public static java.lang.String createJobMasterPodName(java.lang.String jobID)
public static java.lang.String createRestartWorkerKey(int workerID)
public static java.lang.String createRestartJobMasterKey()
public static java.lang.String jobPackageFullPath(Config config, java.lang.String jobID)
public static int numberOfWorkerPods(JobAPI.Job job)
job
- public static java.util.ArrayList<java.lang.String> generatePodNames(JobAPI.Job job)
job
- public static boolean isPodRunning(V1Pod pod)
pod
- public static boolean allContainersReady(java.util.List<V1ContainerStatus> contStatuses)