Klasse KubeConfig

java.lang.Object
de.dlr.proseo.planner.kubernetes.KubeConfig

@Component public class KubeConfig extends Object
Represents the connection to a Kubernetes API
Autor:
Ernst Melchinger
  • Konstruktordetails

    • KubeConfig

      public KubeConfig()
      Instantiates a new KubeConfig object without arguments.
    • KubeConfig

      public KubeConfig(ProcessingFacility processingFacility, ProductionPlanner planner)
      Instantiates a new KubeConfig object with a processing facility.
      Parameter:
      processingFacility - the processing facility to set
      planner - the production planner
  • Methodendetails

    • getJobCreatingList

      public HashMap<Long,Long> getJobCreatingList()
      Gibt zurück:
      the jobCreatingList
    • setJobCreatingList

      public void setJobCreatingList(HashMap<Long,Long> jobCreatingList)
      Parameter:
      jobCreatingList - the jobCreatingList to set
    • getProductionPlanner

      public ProductionPlanner getProductionPlanner()
      Returns the production planner.
      Gibt zurück:
      the production planner
    • getMaxJobsPerNode

      public Integer getMaxJobsPerNode()
      Returns the maximum number of jobs per node.
      Gibt zurück:
      the maximum number of jobs per node
    • setMaxJobsPerNode

      public void setMaxJobsPerNode(Integer maxJobsPerNode)
      Sets the maximum number of jobs per node.
      Parameter:
      maxJobsPerNode - the maximum number of jobs per node to set
    • getStorageManagerPassword

      public String getStorageManagerPassword()
      Returns the storage manager password.
      Gibt zurück:
      the storage manager password
    • setStorageManagerPassword

      public void setStorageManagerPassword(String storageManagerPassword)
      Sets the storage manager password.
      Parameter:
      storageManagerPassword - the storage manager password to set
    • getProcessingEngineToken

      public String getProcessingEngineToken()
      Returns the processing engine token.
      Gibt zurück:
      the processing engine token
    • getLocalStorageManagerUrl

      public String getLocalStorageManagerUrl()
      Returns the local storage manager URL.
      Gibt zurück:
      the local storage manager URL
    • getStorageManagerUser

      public String getStorageManagerUser()
      Returns the storage manager user.
      Gibt zurück:
      the storage manager user
    • setStorageManagerUrl

      public void setStorageManagerUrl(String storageManagerUrl)
      Sets the storage manager URL.
      Parameter:
      storageManagerUrl - the storage manager URL to set
    • getExternalStorageManagerUrl

      public String getExternalStorageManagerUrl()
      Returns the external storage manager URL.
      Gibt zurück:
      the external storage manager URL
    • setExternalStorageManagerUrl

      public void setExternalStorageManagerUrl(String externalStorageManagerUrl)
      Sets the external storage manager URL.
      Parameter:
      externalStorageManagerUrl - the external storage manager URL to set
    • setProcessingEngineToken

      public void setProcessingEngineToken(String processingEngineToken)
      Sets the processing engine token.
      Parameter:
      processingEngineToken - the processing engine token to set
    • setLocalStorageManagerUrl

      public void setLocalStorageManagerUrl(String localStorageManagerUrl)
      Sets the local storage manager URL.
      Parameter:
      localStorageManagerUrl - the local storage manager URL to set
    • setStorageManagerUser

      public void setStorageManagerUser(String storageManagerUser)
      Sets the storage manager user.
      Parameter:
      storageManagerUser - the storage manager user to set
    • getStorageType

      public StorageType getStorageType()
      Returns the storage type.
      Gibt zurück:
      the storage type
    • setStorageType

      public void setStorageType(StorageType storageType)
      Sets the storage type.
      Parameter:
      storageType - the storage type to set
    • getProcessingFacility

      public ProcessingFacility getProcessingFacility()
      Returns the processing facility.
      Gibt zurück:
      the processing facility
    • setProcessingFacility

      public void setProcessingFacility(ProcessingFacility processingFacility)
      Sets the processing facility.
      Parameter:
      processingFacility - the processing facility to set
    • getKubeJob

      public KubeJob getKubeJob(String name)
      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

      public void setFacility(ProcessingFacility processingFacility)
      Sets all locally stored variables based on the provided processing facility.
      Parameter:
      processingFacility - the processing facility
    • getStorageManagerUrl

      public String 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

      public boolean couldJobRun(Long jsId)
      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

      public KubeJob createJob(String name, String stdoutLogLevel, String stderrLogLevel)
      Creates a new job on the cluster with the specified name and log levels.
      Parameter:
      name - the name of the new job
      stdoutLogLevel - the log level for stdout
      stderrLogLevel - 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 job
      stdoutLogLevel - the log level for stdout
      stderrLogLevel - the log level for stderr
      Gibt zurück:
      the created job or null
    • deleteJob

      public boolean deleteJob(KubeJob jobToDelete)
      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

      public boolean deleteJob(String name)
      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

      public io.kubernetes.client.openapi.models.V1Job getV1Job(String name)
      Retrieves a Kubernetes job with the specified name.
      Parameter:
      name - the name of the job
      Gibt zurück:
      the job found or null
    • getV1Pod

      public io.kubernetes.client.openapi.models.V1Pod getV1Pod(String name)
      Retrieves a Kubernetes pod with the specified name.
      Parameter:
      name - the name of the pod
      Gibt zurück:
      the pod found or null
    • getNamespace

      public String getNamespace()
      Retrieves the namespace.
      Gibt zurück:
      the namespace
    • getId

      public String 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

      public String getUrl()
      Retrieves the URL.
      Gibt zurück:
      the URL
    • getProcessingEngineUrl

      public String getProcessingEngineUrl()
      Retrieves the processing engine URL.
      Gibt zurück:
      the processing engine URL
    • getDescription

      public String getDescription()
      Retrieves the description.
      Gibt zurück:
      the description
    • getFacilityState

      public FacilityState getFacilityState(ProcessingFacility facility)
      Retrieves the facility state.
      Gibt zurück:
      the facility state
    • setFacilityState

      public void setFacilityState(FacilityState facilityState)
      Sets the facility state.
      Parameter:
      facilityState - the facility state to set
    • deletePodNamed

      public boolean deletePodNamed(String name)
      Deletes a job.
      Parameter:
      name - the name of the pod/job
      Gibt zurück:
      true if the job was successfully deleted, otherwise false
    • deletePodsStatus

      public boolean deletePodsStatus(String status)
      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