loading...

Automation of helm | step 5

coktopus profile image coktopus ・2 min read

To automate helm deployment we a need circleCI configuration.

BRANCH FILTER

workflow provides an option to filter the branches on which the circleCI pipeline runs:

DEV

workflows:
  main:
    jobs:
      - deploy:
          filters:
            branches:
              only: 
                [project-for-video-dev]

PROD

workflows:
  main:
    jobs:
      - deploy:
          filters:
            branches:
              only: 
                [project-for-video-prod]

ORBS

  • gcp-gke is use to interact with kubernetes engine running in gcloud. It have commands like create-cluster, delete-cluster, and so on . we use rollout-image which updates the deployment with latest image.

  • gcp-gcr has built in commands and gcr-auth is use to authenticate the user and it will take the credentials from environment variables of circleCI.

All the images stored in Google Container Registry is a perfectly working image and ready to deploy on environment . so replace the current tag running tag with the newer one in config.yml and push it to repository and merge it to the branch which triggers the circleCI pipeline and circleCI is already setup to run rollout-image command.

EXAMPLE

dev branch contains config.yml file and all the values required to update dev. If any tag will merged to dev branch it will trigger the pipeline and update the dev-deployment with the newly merged tag of image and same in the case of other branches like prod.

KUBERNETES PROCESS

Once the pipeline is triggered, the kubernetes run their blue-green deployment process and update the image with zero down time.

Discussion

pic
Editor guide