Steps to follow for seting up a sample GitOps pipelines using gitops-cli
-
Complete all the pre-requisite steps mentioned in the docs
-
Bootstrap a GitOps repository following steps mentioned in the docs
odo pipelines bootstrap --service-repo-url https://github.com/<username>/taxi.git \ --dockercfgjson ~/Downloads/<username>-gitops-auth.json \ --gitops-repo-url https://github.com/<username>/gitops-example.git \ --image-repo quay.io/<username>/taxi --prefix demo --output <output directory> \ --sealed-secrets-svc sealed-secrets-controller --sealed-secrets-ns kube-system
-
This bootstraps your gitops repo with two environments
demo-devanddemo-stage.demo-devhas an appapp-taxiwith one servicetaxi.
-
Update the labels of the deployment of taxi service.
- Copy labels from
environments/demo-dev/apps/app-taxi/services/taxi/base/config/200-service.yamltoenvironments/demo-dev/apps/app-taxi/services/taxi/base/config/100-deployment.yaml
- Copy labels from
-
Add a new service
busto the created appapp-taxiindemo-devenvironment -odo pipelines service add --app-name app-taxi --env-name demo-dev \ --pipelines-folder <bootstrapped gitops folder> \ --service-name bus --sealed-secrets-ns kube-system \ --sealed-secrets-svc sealed-secrets-controller \ --git-repo-url https://github.com/<username>/bus.git
-
Copy
configfolder fromtaxi/base/tobus/base/.- Update
100-deployment.yamland200-service.yamlto change names and labels fromtaxitobus.
- Update
-
Add
taxiandbusservice toapp-taxifordemo-stageenvironment.odo pipelines service add --app-name app-taxi --env-name demo-stage \ --pipelines-folder <bootstrapped gitops folder> \ --service-name taxi --sealed-secrets-ns kube-system \ --sealed-secrets-svc sealed-secrets-controller
odo pipelines service add --app-name app-taxi --env-name demo-stage \ --pipelines-folder <bootstrapped gitops folder> \ --service-name bus --sealed-secrets-ns kube-system \ --sealed-secrets-svc sealed-secrets-controller
-
Copy
configfolder from both the servicestaxiandbusofdemo-devtodemo-stage.- Update the namespace of service and deployments of
demo-stage. - Update the replicas for deployments to 2.
- Update the namespace of service and deployments of
-
Add a new environement
demo-prod.odo pipelines environment add --env-name demo-prod --pipelines-folder <bootstrapped gitops folder>
-
Add
taxiandbusservice toapp-taxifordemo-prodenvironment.odo pipelines service add --app-name app-taxi --env-name demo-prod \ --pipelines-folder <bootstrapped gitops folder> \ --service-name taxi --sealed-secrets-ns kube-system \ --sealed-secrets-svc sealed-secrets-controller
odo pipelines service add --app-name app-taxi --env-name demo-prod \ --pipelines-folder <bootstrapped gitops folder> \ --service-name bus --sealed-secrets-ns kube-system \ --sealed-secrets-svc sealed-secrets-controller
-
Copy
configfolder from both the servicestaxiandbusofdemo-devtodemo-prod.- Update the namespace of service and deployments of
demo-prod. - Update the replicas for deployments to 3.
- Update the namespace of service and deployments of
-
Bring up the deployments and environments -
oc apply -k config/argocd/oc apply -k config/demo-cicd/baseoc apply -k environments/demo-dev/env/baseoc apply -k environments/demo-stage/env/baseoc apply -k environments/demo-prod/env/baseoc apply -k environments/demo-dev/apps/app-taxioc apply -k environments/demo-stage/apps/app-taxioc apply -k environments/demo-prod/apps/app-taxi