Package de.dlr.proseo.planner.kubernetes
Klasse KubeConfig
java.lang.Object
de.dlr.proseo.planner.kubernetes.KubeConfig
Represents the connection to a Kubernetes API
- Autor:
- Ernst Melchinger
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungInstantiates a new KubeConfig object without arguments.KubeConfig
(ProcessingFacility processingFacility, ProductionPlanner planner) Instantiates a new KubeConfig object with a processing facility. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
connect()
Connects to the Kubernetes cluster.boolean
couldJobRun
(Long jsId) Checks whether a new Kubernetes job could run.Creates a new job on the cluster with the specified ID and log levels.Creates a new job on the cluster with the specified name and log levels.boolean
Deletes a job from the cluster.boolean
Deletes a named job from the cluster.boolean
deletePodNamed
(String name) Deletes a job.boolean
deletePodsStatus
(String status) Deletes all pods with the specified status.io.kubernetes.client.openapi.apis.CoreV1Api
getApiV1()
Returns the CoreV1Api.io.kubernetes.client.openapi.apis.BatchV1Api
Returns the BatchV1Api.io.kubernetes.client.openapi.ApiClient
Returns the API client.Retrieves the description.Returns the external storage manager URL.getFacilityState
(ProcessingFacility facility) Retrieves the facility state.getId()
Retrieves the ID.io.kubernetes.client.openapi.models.V1JobList
Retrieves the list of jobs in the cluster.getKubeJob
(String name) Looks for the Kubernetes job with the specified name.Returns the local storage manager URL.long
Retrieves the long ID.Returns the maximum number of jobs per node.Retrieves the namespace.boolean
Searches for ready worker nodes on the Kubernetes cluster.io.kubernetes.client.openapi.models.V1PodList
Retrieves the list of pods in the cluster.Returns the processing engine token.Retrieves the processing engine URL.Returns the processing facility.Returns the production planner.Returns the storage manager password.Returns the storage manager URL.Returns the storage manager user.Returns the storage type.getUrl()
Retrieves the URL.io.kubernetes.client.openapi.models.V1Job
Retrieves a Kubernetes job with the specified name.io.kubernetes.client.openapi.models.V1Pod
Retrieves a Kubernetes pod with the specified name.long
Retrieves the version.int
Returns the worker count.boolean
Checks if the connection to the Kubernetes cluster is established.void
setExternalStorageManagerUrl
(String externalStorageManagerUrl) Sets the external storage manager URL.void
setFacility
(ProcessingFacility processingFacility) Sets all locally stored variables based on the provided processing facility.void
setFacilityState
(FacilityState facilityState) Sets the facility state.void
setJobCreatingList
(HashMap<Long, Long> jobCreatingList) void
setLocalStorageManagerUrl
(String localStorageManagerUrl) Sets the local storage manager URL.void
setMaxJobsPerNode
(Integer maxJobsPerNode) Sets the maximum number of jobs per node.void
setProcessingEngineToken
(String processingEngineToken) Sets the processing engine token.void
setProcessingFacility
(ProcessingFacility processingFacility) Sets the processing facility.void
setStorageManagerPassword
(String storageManagerPassword) Sets the storage manager password.void
setStorageManagerUrl
(String storageManagerUrl) Sets the storage manager URL.void
setStorageManagerUser
(String storageManagerUser) Sets the storage manager user.void
setStorageType
(StorageType storageType) Sets the storage type.void
sync()
Synchronizes the Kubernetes jobs and the internal KubeJob list with the Planner.
-
Konstruktordetails
-
KubeConfig
public KubeConfig()Instantiates a new KubeConfig object without arguments. -
KubeConfig
Instantiates a new KubeConfig object with a processing facility.- Parameter:
processingFacility
- the processing facility to setplanner
- the production planner
-
-
Methodendetails
-
getJobCreatingList
- Gibt zurück:
- the jobCreatingList
-
setJobCreatingList
- Parameter:
jobCreatingList
- the jobCreatingList to set
-
getProductionPlanner
Returns the production planner.- Gibt zurück:
- the production planner
-
getMaxJobsPerNode
Returns the maximum number of jobs per node.- Gibt zurück:
- the maximum number of jobs per node
-
setMaxJobsPerNode
Sets the maximum number of jobs per node.- Parameter:
maxJobsPerNode
- the maximum number of jobs per node to set
-
getStorageManagerPassword
Returns the storage manager password.- Gibt zurück:
- the storage manager password
-
setStorageManagerPassword
Sets the storage manager password.- Parameter:
storageManagerPassword
- the storage manager password to set
-
getProcessingEngineToken
Returns the processing engine token.- Gibt zurück:
- the processing engine token
-
getLocalStorageManagerUrl
Returns the local storage manager URL.- Gibt zurück:
- the local storage manager URL
-
getStorageManagerUser
Returns the storage manager user.- Gibt zurück:
- the storage manager user
-
setStorageManagerUrl
Sets the storage manager URL.- Parameter:
storageManagerUrl
- the storage manager URL to set
-
getExternalStorageManagerUrl
Returns the external storage manager URL.- Gibt zurück:
- the external storage manager URL
-
setExternalStorageManagerUrl
Sets the external storage manager URL.- Parameter:
externalStorageManagerUrl
- the external storage manager URL to set
-
setProcessingEngineToken
Sets the processing engine token.- Parameter:
processingEngineToken
- the processing engine token to set
-
setLocalStorageManagerUrl
Sets the local storage manager URL.- Parameter:
localStorageManagerUrl
- the local storage manager URL to set
-
setStorageManagerUser
Sets the storage manager user.- Parameter:
storageManagerUser
- the storage manager user to set
-
getStorageType
Returns the storage type.- Gibt zurück:
- the storage type
-
setStorageType
Sets the storage type.- Parameter:
storageType
- the storage type to set
-
getProcessingFacility
Returns the processing facility.- Gibt zurück:
- the processing facility
-
setProcessingFacility
Sets the processing facility.- Parameter:
processingFacility
- the processing facility to set
-
getKubeJob
Looks for the Kubernetes job with the specified name.- Parameter:
name
- the name of the Kubernetes job- Gibt zurück:
- the found Kubernetes job or null if not found
-
setFacility
Sets all locally stored variables based on the provided processing facility.- Parameter:
processingFacility
- the processing facility
-
getStorageManagerUrl
Returns the storage manager URL.- Gibt zurück:
- the storage manager URL
-
getClient
public io.kubernetes.client.openapi.ApiClient getClient()Returns the API client.- Gibt zurück:
- the API client
-
getApiV1
public io.kubernetes.client.openapi.apis.CoreV1Api getApiV1()Returns the CoreV1Api.- Gibt zurück:
- the CoreV1Api
-
getBatchApiV1
public io.kubernetes.client.openapi.apis.BatchV1Api getBatchApiV1()Returns the BatchV1Api.- Gibt zurück:
- the BatchV1Api
-
getWorkerCnt
public int getWorkerCnt()Returns the worker count.- Gibt zurück:
- the worker count
-
connect
public boolean connect()Connects to the Kubernetes cluster.- Gibt zurück:
- true if connected, otherwise false
-
isConnected
public boolean isConnected()Checks if the connection to the Kubernetes cluster is established.- Gibt zurück:
- true if connected, otherwise false
-
couldJobRun
Checks whether a new Kubernetes job could run.- Gibt zurück:
- true if a new job could run, otherwise false
-
sync
public void sync()Synchronizes the Kubernetes jobs and the internal KubeJob list with the Planner. -
getPodList
public io.kubernetes.client.openapi.models.V1PodList getPodList()Retrieves the list of pods in the cluster.- Gibt zurück:
- the list of pods
-
getJobList
public io.kubernetes.client.openapi.models.V1JobList getJobList()Retrieves the list of jobs in the cluster.- Gibt zurück:
- the list of jobs
-
createJob
Creates a new job on the cluster with the specified name and log levels.- Parameter:
name
- the name of the new jobstdoutLogLevel
- the log level for stdoutstderrLogLevel
- the log level for stderr- Gibt zurück:
- the created job or null
-
createJob
@Transactional(isolation=REPEATABLE_READ) public KubeJob createJob(long id, String stdoutLogLevel, String stderrLogLevel) Creates a new job on the cluster with the specified ID and log levels.- Parameter:
id
- the ID of the jobstdoutLogLevel
- the log level for stdoutstderrLogLevel
- the log level for stderr- Gibt zurück:
- the created job or null
-
deleteJob
Deletes a job from the cluster.- Parameter:
jobToDelete
- the job to delete- Gibt zurück:
- true if the job was successfully deleted, otherwise false
-
deleteJob
Deletes a named job from the cluster.- Parameter:
name
- the name of the job to delete- Gibt zurück:
- true if the job was successfully deleted, otherwise false
-
getV1Job
Retrieves a Kubernetes job with the specified name.- Parameter:
name
- the name of the job- Gibt zurück:
- the job found or null
-
getV1Pod
Retrieves a Kubernetes pod with the specified name.- Parameter:
name
- the name of the pod- Gibt zurück:
- the pod found or null
-
getNamespace
Retrieves the namespace.- Gibt zurück:
- the namespace
-
getId
Retrieves the ID.- Gibt zurück:
- the ID
-
getLongId
public long getLongId()Retrieves the long ID.- Gibt zurück:
- the long ID
-
getVersion
public long getVersion()Retrieves the version.- Gibt zurück:
- the version
-
getUrl
Retrieves the URL.- Gibt zurück:
- the URL
-
getProcessingEngineUrl
Retrieves the processing engine URL.- Gibt zurück:
- the processing engine URL
-
getDescription
Retrieves the description.- Gibt zurück:
- the description
-
getFacilityState
Retrieves the facility state.- Gibt zurück:
- the facility state
-
setFacilityState
Sets the facility state.- Parameter:
facilityState
- the facility state to set
-
deletePodNamed
Deletes a job.- Parameter:
name
- the name of the pod/job- Gibt zurück:
- true if the job was successfully deleted, otherwise false
-
deletePodsStatus
Deletes all pods with the specified status.- Parameter:
status
- the status of the pods to delete- Gibt zurück:
- true if the pods were successfully deleted, otherwise false
-
getNodeInfo
public boolean getNodeInfo()Searches for ready worker nodes on the Kubernetes cluster.- Gibt zurück:
- true if at least one worker node is ready, otherwise false
-