Workshop - Promote an Application using CD with GitOps and ArgoCD
Promote an Application using CD with GitOps and ArgoCD
Prerequisites
- Complete lab Deploy an Application using CI Pipelines with Tekton.
Set
TOOLKIT_USERNAMEenvironment variable. If you are participation in a workshop replaceuserdemowith your assigned username (ex.user01).TOOLKIT_USERNAME=userdemoSet
TOOLKIT_PROJECTenvironment variable. If you are participation in a workshop replaceprojectdemobased on your assigned username (ex.project01).TOOLKIT_PROJECT=projectdemoVerify Application is deployed in QA
- Select ArgoCD from the Console Link and login using OpenShift login
- Filter Applications by name
${TOOLKIT_PROJECT}-qa(ie project01-qa) - Select the application
master-qa-${TOOLKIT_PROJECT}-app(ie master-qa-project01-app)
Verify Application is running in the QA namespace corresponding to your username
${TOOLKIT_PROJECT}-qa- Select Developer perspective, select project
${TOOLKIT_PROJECT}-qaand then select Topology from the Console and see the application running
- Select Developer perspective, select project
Setup environment variable
GIT_OPS_URLfor the git url using the value from previous step or as followingGIT_OPS_URL=http://${TOOLKIT_USERNAME}:password@$(oc get route -n tools gogs --template='{{.spec.host}}')/toolkit/gitopsecho GIT_OPS_URL=${GIT_OPS_URL}Clone the git repository and change directory
cd $HOMEgit clone $GIT_OPS_URLcd gitopsReview the
qaandstagingdirectory in the git repositoryls -l qa/ls -l staging/Promote the application from QA to STAGING by copying the app manifest files using git
git config --local user.email "${TOOLKIT_USERNAME}@example.com"git config --local user.name "${TOOLKIT_USERNAME}"cp -a qa/${TOOLKIT_PROJECT}/ staging/${TOOLKIT_PROJECT}/git add .git commit -m "Promote Application from QA to STAGING environment for $TOOLKIT_PROJECT"git push -u origin masterVerify Application is deployed in STAGING
- Select ArgoCD from the Console Link and login using OpenShift login
- Filter Applications by namespace
${TOOLKIT_PROJECT}-staging(ie project01-staging) - It might take a couple minutes for the application to show up
- Select the application
master-staging-${TOOLKIT_PROJECT}-app(ie master-staging-project01-app) - Click Refresh
Verify Application is running in the STAGING namespace corresponding to your username
${TOOLKIT_PROJECT}- Select Developer perspective, select project
${TOOLKIT_PROJECT}-stagingand then select Topology from the Console and see the application running
- Select Developer perspective, select project
Propose a change for the Application in STAGING
- Update the replica count and create a new git branch in remote repo
cat > staging/${TOOLKIT_PROJECT}/app/values.yaml <<EOFglobal: {}app:replicaCount: 2EOFgit diffgit add .- Open Git Ops from Console Link
- Select toolkit/gitops git repository
- Create a Pull Request
- Select Pull Request
- Click New Pull Request
- Select from
comparedropdown the branch${TOOLKIT_PROJECT}-pr1 - Enter a title like
Update replica count for app in namespace $TOOLKIT_PROJECT - Enter a Comment like
We need more instances business is growing Yay! - click Create Pull Request
Review the PR follow the change management process established by your team.
- Click Merge Pull Request
- Click Delete Branch
Review that application scales out
- Review in ArgoCD UI, notice there are now two pods, it takes about 4 minutes to sync, you can click Refresh
- Review in OpenShift Console, click the Deployment circle details shows 2 Pods.
- Review in ArgoCD UI, notice there are now two pods, it takes about 4 minutes to sync, you can click Refresh
Congratulations you finished this activity, continue with the lab Deploy a 3 tier Microservice using React, Node.js, and Java