Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR relies on #195.
Resolve K8s comments in #180
Proposal to Refactor KubernetesSystem by Introducing Manager Classes
1. Background
KubernetesSystem
class interacts directly with three Kubernetes APIs (CoreV1Api
,BatchV1Api
, andCustomObjectsApi
).KubernetesSystem
class itself, which can lead to a bloated design as more functionalities are added.2. Problem
3. Proposed Solution
KubernetesSystem
class by delegating specific API interactions to separate manager classes, where each manager class is responsible for interacting with one API.CoreV1APIManager
: Handles interactions with theCoreV1Api
, such as managing pods, namespaces, and nodes.BatchAPIManager
: Manages batch jobs via theBatchV1Api
.CustomObjectsAPIManager
: Manages custom objects such asmpi_job
via theCustomObjectsApi
.4. Benefits
5. API Manager Classes
5.1 CoreV1APIManager
list_pods
: Lists pods in a namespace.create_namespace
: Creates a new namespace.delete_namespace
: Deletes an existing namespace.patch_node
: Updates a node by applying a patch.5.2 BatchAPIManager
BatchV1Api
.create_job
: Submits a new batch job.delete_job
: Deletes an existing batch job.read_job_status
: Reads the status of a batch job.5.3 CustomObjectsAPIManager
mpi_job
using theCustomObjectsApi
.create_mpi_job
: Submits a new MPI job.delete_mpi_job
: Deletes an existing MPI job.get_mpi_job_status
: Gets the status of a specific MPI job.6. Refactoring KubernetesSystem
The
KubernetesSystem
class will be refactored to delegate API interactions to the newly introduced manager classes. This reduces the complexity inKubernetesSystem
, making it more focused on high-level orchestration rather than API details.Test Plan