This CLI tool allows you to manage KIND clusters, ArgoCD applications, Jenkins jobs and Kubernetes efficiently using Python. It provides functionality for working with Docker containers, KIND clusters, ArgoCD applications, Jenkins jobs and Kubernetes clusters.
-
KIND Cluster Management:
- Get the Docker container running KIND cluster.
- Execute
crictl
commands in KIND Docker container. - Load Docker images into KIND clusters.
- WIP ...
-
ArgoCD Management:
- Template a new service by creating an
ApplicationSet
. - Load an ArgoCD project application from a local file.
- List all applications and select the applications to sync.
- WIP ...
- Template a new service by creating an
-
Jenkins Management:
- Get details of a Jenkins job.
- Trigger a Jenkins job build.
- List all Jenkins jobs.
- WIP ...
-
Kubernetes Management:
- list pods.
- Describe pods.
- Delete pods.
- WIP ...
- Python 3.9
- Docker
- KIND
- crictl
- ArgoCD CLI
- Jenkins API Python library (
jenkinsapi
) - Kubernetes
-
Clone the repository:
git clone https://github.com/zrougamed/core-cli.git cd core-cli
-
Install dependencies:
pip install -r requirements.txt
-
Compile the CLI using PyInstaller:
pyinstaller --onefile cli.py
This will generate an executable in the
dist
directory.
The CLI has these main commands: kind
, argocd
, jenkins
and kubernetes
, each with their respective subcommands.
-
Get Docker Container:
./dist/cli kind get-container <container_name>
Retrieves the Docker container running the KIND cluster.
-
Execute crictl Command:
./dist/cli kind exec-crictl <container_id> <crictl_command>
Executes a
crictl
command in the specified KIND Docker container. -
Load Docker Image into KIND Cluster:
./dist/cli kind load-image <cluster_name> <image>
Loads a Docker image into the specified KIND cluster.
-
Template Service:
./dist/cli argocd template-service <service_name> <project_name> <repo_url> <path>
Templates a new service by creating an
ApplicationSet
for ArgoCD. -
Load Application from Local File:
./dist/cli argocd load-application <app_name> <file_path>
Loads an ArgoCD project application from a local file.
-
List and Sync Applications:
./dist/cli argocd list-sync
Lists all ArgoCD applications and allows you to select and sync them.
-
Get Job Details:
./dist/cli jenkins get-job <url> <username> <password> <job_name>
Retrieves the details of a specified Jenkins job.
-
Trigger Job Build:
./dist/cli jenkins build-job <url> <username> <password> <job_name>
Triggers a build for the specified Jenkins job.
-
List All Jobs:
./dist/cli jenkins list-jobs <url> <username> <password>
Lists all jobs on the specified Jenkins server.
-
List Pods:
./dist/cli kubectl list-pods [--namespace <namespace>]
Lists pods in the specified namespace. Default namespace is 'default'.
-
List Services:
./dist/cli kubectl list-services [--namespace <namespace>]
Lists services in the specified namespace. Default namespace is 'default'.
-
Delete Pod:
./dist/cli kubectl delete-pod <pod_name> [--namespace <namespace>]
Deletes the specified pod in the specified namespace. Default namespace is 'default'.
-
Describe Pod:
./dist/cli kubectl describe-pod <pod_name> [--namespace <namespace>]
Describes the specified pod in the specified namespace. Default namespace is 'default'.
-
Get Docker Container:
./dist/cli kind get-container kind-control-plane
Output:
Container ID: abc123def456
-
Execute crictl Command:
./dist/cli kind exec-crictl abc123def456 crictl images
-
Load Docker Image into KIND Cluster:
./dist/cli kind load-image kind-cluster my-image:latest
-
Template Service:
./dist/cli argocd template-service my-service my-project https://github.com/<username>/service
-
Load Application from Local File:
./dist/cli argocd load-application my-app /path/to/app.yaml
-
List and Sync Applications:
./dist/cli argocd list-sync
-
Get Jenkins Job Details:
./dist/cli jenkins get-job http://jenkins.example.com username password my-job
-
Trigger Jenkins Job Build:
./dist/cli jenkins build-job http://jenkins.example.com username password my-job
-
List All Jenkins Jobs:
./dist/cli jenkins list-jobs http://jenkins.example.com username password
Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.
This project is licensed under the MIT License.