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-dev
anddemo-stage
.demo-dev
has an appapp-taxi
with 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.yaml
toenvironments/demo-dev/apps/app-taxi/services/taxi/base/config/100-deployment.yaml
- Copy labels from
-
Add a new service
bus
to the created appapp-taxi
indemo-dev
environment -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
config
folder fromtaxi/base/
tobus/base/
.- Update
100-deployment.yaml
and200-service.yaml
to change names and labels fromtaxi
tobus
.
- Update
-
Add
taxi
andbus
service toapp-taxi
fordemo-stage
environment.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
config
folder from both the servicestaxi
andbus
ofdemo-dev
todemo-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
taxi
andbus
service toapp-taxi
fordemo-prod
environment.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
config
folder from both the servicestaxi
andbus
ofdemo-dev
todemo-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/base
oc apply -k environments/demo-dev/env/base
oc apply -k environments/demo-stage/env/base
oc apply -k environments/demo-prod/env/base
oc apply -k environments/demo-dev/apps/app-taxi
oc apply -k environments/demo-stage/apps/app-taxi
oc apply -k environments/demo-prod/apps/app-taxi