__
_________ ____/ /__ _ __
/ ___/ __ \/ __ / _ \ | / /
/ /__/ / / / /_/ / __/ |/ /
\___/_/ /_/\__,_/\___/|___/
cndev is a command line utility for the Container Native Developers, who develop applications and microservices and intend to deploy them in the Kubernetes Cluster. A lot of processes are involved between the developer coding the microservice, and it gets deployed onto a cluster in targeted environment.
Tools like ArgoCD is used as GitOps engine for the continuous deployment(CD) from source code control system to the environments. But these would require a configuration to make sure the service is deployed correctly. And this configuration is done as a manifest in the git repo again; which would be a centralized repository for the entire developer community. Doing the configuration for the first time or need to redo the configuration for every minimal change is going to need a lot of time-consuming build, approval process for the PR etc.
To reduce these time-consuming process, cndev mimics the CD environment into your private environment. You will be bootstrapping the Git server and ArgoCD components in your private cluster.
There are certain prerequisites for the cndev to work as expected. Feel free to raise a PR or an issue to make it more usable.
- A locally provisioned Kubernetes Cluster
- A valid kubeconfig pointing to a valid Kubernetes cluster
- Admin access to the cluster is required
argocd
cli tool and basic knowledge of how to use it
After having a private cluster or a valid kubeconfig file that points to the Kubernetes cluster that you have admin access to, the next step is to provision the CD infra.
- Make a directory or clone a git repository in you local machine.
- cd into the directory.
- If it's a new directory, code the app and create the deployment manifests.
- Execute
cndev init
to provision the Git server and ArgoCD server. - Run
cndev pfa -f git
and in another terminalcndev pfa -f argocd
. This will open up the Git UI and ArgoCD UI in your default browser. - A one time initial setup is necessary for Git Server.
- Choose
SQLite3
for the database. - Change the port number on
Application URL
text box to the port number on your address bar and clickInstall Gogs
. - Now click
Sign up now
link and create a user for yourself and login. That's your local git server.
- Choose
- Create a repository in the private git and push your changes from local machine.
- Once the app pushed into the Git repo, you can stop the port forwarding executed by
cndev pfa -f git
command. - Head over to the terminal where you executed the
cndev pfa -f argocd
command.- Copy the username and password from the terminal.
- Use that to login to ArgoCD UI.
- Create a new application by clicking
+ NEW APP
. - Enter the
Application Name
as your app name. - Choose
default
forProject
. - For the
Repository URL
, copy thehttp
url from your local git and replacehttp://localhost:<port>
tohttp://gogs-svc.gogs.svc:18080
. - Choose the path for the deployment manifests.
- Choose the default
https://kubernetes.default.svc
as theCluster URL
. - Desired namespace to deploy, and click
Create
.
- Now for every change in the manifests, you can sync them from your local machine by running the following command.
argocd app sync <Application Name> --local <Path to manifests>
.
Private (Cluster/Environment): A local environment or a kubernetes cluster that is running in your local machine.