public final class KubernetesController
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
addConfigMapParam(java.lang.String jobID,
java.lang.String keyName,
java.lang.String value)
add a new parameter the job ConfigMap
|
static void |
close() |
boolean |
createConfigMap(V1ConfigMap configMap)
create the given ConfigMap on Kubernetes master
|
static CoreV1Api |
createCoreV1Api()
create CoreV1Api that does not time out
|
boolean |
createPersistentVolume(V1PersistentVolume pv)
create the given service on Kubernetes master
|
boolean |
createPersistentVolumeClaim(V1PersistentVolumeClaim pvc)
create the given PersistentVolumeClaim on Kubernetes master
|
boolean |
createService(V1Service service)
create the given service on Kubernetes master
|
boolean |
createStatefulSet(V1StatefulSet statefulSet)
create the given StatefulSet on Kubernetes master
|
boolean |
deleteConfigMap(java.lang.String jobID)
delete the given ConfigMap from Kubernetes master
|
boolean |
deleteJobPackage(java.util.List<java.lang.String> uploaderPods,
java.lang.String jobPackageName)
delete job package file from uploader web server pods
currently it does not delete job package file from multiple uploader pods
so, It is not in use
|
boolean |
deletePersistentVolume(java.lang.String pvName) |
boolean |
deletePersistentVolumeClaim(java.lang.String jobID) |
boolean |
deleteService(java.lang.String serviceName)
delete the given service from Kubernetes master
|
boolean |
deleteStatefulSet(java.lang.String statefulSetName)
delete the given StatefulSet from Kubernetes master
|
boolean |
existConfigMap(java.lang.String jobID)
return true if there is already a ConfigMap object with the same name on Kubernetes master,
otherwise return false
|
boolean |
existPersistentVolumeClaim(java.lang.String jobID)
check whether the given PersistentVolumeClaim exist on Kubernetes master
|
boolean |
existSecret(java.lang.String secretName)
return true if the Secret object with that name exists in Kubernetes master,
otherwise return false
|
java.lang.String |
existServices(java.util.List<java.lang.String> serviceNames)
return existing service name if one of the services exist in Kubernetes master,
otherwise return null
|
boolean |
existStatefulSets(java.util.List<java.lang.String> statefulSetNames)
check whether given StatefulSet objects exist Kubernetes master,
|
static ApiClient |
getApiClient() |
java.lang.String |
getConfigMapParam(java.lang.String jobID,
java.lang.String keyName)
return configMap parameter value for the given jobID
if there is no value for the key, return null
|
java.util.Map<java.lang.String,java.lang.String> |
getConfigMapParams(java.lang.String jobID)
return all configMap parameters for the given jobID
if there is no ConfigMap, throw an exception
|
V1ConfigMap |
getJobConfigMap(java.lang.String jobID)
return the ConfigMap object of this job, if it exists,
otherwise return null
|
V1PersistentVolumeClaim |
getJobPersistentVolumeClaim(java.lang.String jobID)
get PersistentVolumeClaim object for this job
|
java.util.List<V1Service> |
getJobServices(java.lang.String jobID)
return the list of services that belong to this job
otherwise return an empty list
|
java.util.List<V1StatefulSet> |
getJobStatefulSets(java.lang.String jobID)
return the list of StatefulSet objects for this job,
otherwise return null
|
java.util.ArrayList<java.lang.String> |
getJobWorkerStatefulSets(java.lang.String jobID)
return the list of worker StatefulSet names for this job
they must be in the form of "jobID-index"
otherwise return an empty ArrayList
|
java.util.ArrayList<JobMasterAPI.NodeInfo> |
getNodeInfo(java.lang.String rackLabelKey,
java.lang.String datacenterLabelKey)
get NodeInfoUtils objects for the nodes on this cluster
|
V1PersistentVolume |
getPersistentVolume(java.lang.String pvName) |
int |
getRestartCount(java.lang.String jobID,
java.lang.String keyName)
return restart count for the given workerID
if there is no key for the given workerID, return -1
|
java.lang.String |
getServiceIP(java.lang.String serviceName)
get the IP address of the given service
otherwise return null
|
java.util.List<java.lang.String> |
getTwister2ConfigMapNames()
return the ConfigMap object names that belong to Twister2
otherwise return empty list
ConfigMap names correspond to jobIDs
There is a ConfigMap for each running job
So, this list shows the currently running jobs
|
java.util.List<java.lang.String> |
getTwister2PersistentVolumeClaims()
return the PersistentVolumeClaim object names that belong to Twister2
otherwise return empty list
|
java.util.List<java.lang.String> |
getUploaderWebServerPods(java.lang.String uploaderLabel) |
static KubernetesController |
init(java.lang.String nspace) |
boolean |
patchStatefulSet(java.lang.String ssName,
int replicas)
scale up or down the given StatefulSet
|
boolean |
removeRestartCount(java.lang.String jobID,
java.lang.String keyName)
remove a restart count from the job ConfigMap
this is used when the job is scaled down
|
static boolean |
runProcess(java.lang.String[] command)
sending a command to shell
|
boolean |
updateConfigMapJobParam(JobAPI.Job job) |
boolean |
updateConfigMapParam(java.lang.String jobID,
java.lang.String paramName,
java.lang.String paramValue)
update a parameter value in the job ConfigMap
|
public static KubernetesController init(java.lang.String nspace)
public static ApiClient getApiClient()
public static CoreV1Api createCoreV1Api()
public static void close()
public java.util.List<V1StatefulSet> getJobStatefulSets(java.lang.String jobID)
public boolean existStatefulSets(java.util.List<java.lang.String> statefulSetNames)
public java.util.ArrayList<java.lang.String> getJobWorkerStatefulSets(java.lang.String jobID)
public boolean createStatefulSet(V1StatefulSet statefulSet)
public boolean deleteStatefulSet(java.lang.String statefulSetName)
public boolean patchStatefulSet(java.lang.String ssName, int replicas)
public boolean createService(V1Service service)
public java.util.List<V1Service> getJobServices(java.lang.String jobID)
public java.lang.String existServices(java.util.List<java.lang.String> serviceNames)
public boolean deleteService(java.lang.String serviceName)
public java.lang.String getServiceIP(java.lang.String serviceName)
public static boolean runProcess(java.lang.String[] command)
public boolean existPersistentVolumeClaim(java.lang.String jobID)
public V1PersistentVolumeClaim getJobPersistentVolumeClaim(java.lang.String jobID)
public java.util.List<java.lang.String> getTwister2PersistentVolumeClaims()
public boolean createPersistentVolumeClaim(V1PersistentVolumeClaim pvc)
public boolean deletePersistentVolumeClaim(java.lang.String jobID)
public V1PersistentVolume getPersistentVolume(java.lang.String pvName)
public boolean createPersistentVolume(V1PersistentVolume pv)
public boolean deletePersistentVolume(java.lang.String pvName)
public boolean existSecret(java.lang.String secretName)
public java.util.ArrayList<JobMasterAPI.NodeInfo> getNodeInfo(java.lang.String rackLabelKey, java.lang.String datacenterLabelKey)
public java.util.List<java.lang.String> getUploaderWebServerPods(java.lang.String uploaderLabel)
public boolean deleteJobPackage(java.util.List<java.lang.String> uploaderPods, java.lang.String jobPackageName)
public boolean createConfigMap(V1ConfigMap configMap)
public boolean deleteConfigMap(java.lang.String jobID)
public boolean existConfigMap(java.lang.String jobID)
public java.util.List<java.lang.String> getTwister2ConfigMapNames()
public V1ConfigMap getJobConfigMap(java.lang.String jobID)
public java.lang.String getConfigMapParam(java.lang.String jobID, java.lang.String keyName)
public java.util.Map<java.lang.String,java.lang.String> getConfigMapParams(java.lang.String jobID)
public int getRestartCount(java.lang.String jobID, java.lang.String keyName)
public boolean addConfigMapParam(java.lang.String jobID, java.lang.String keyName, java.lang.String value)
public boolean updateConfigMapParam(java.lang.String jobID, java.lang.String paramName, java.lang.String paramValue)
public boolean updateConfigMapJobParam(JobAPI.Job job)
public boolean removeRestartCount(java.lang.String jobID, java.lang.String keyName)