/bluegreen

Simple demo code for Blue Green Deployments

Primary LanguageJavaScript

A simple PHP application

Blue green deployment is an application release model that gradually transfers user traffic from a previous version of an app or microservice to a nearly identical new release—both of which are running in production.

Create Pipeline

oc new-project bluegreen-pipeline
oc new-project bluegreen-dev
oc new-project bluegreen-test
oc create -f .tkn/resources/resources.yaml -n bluegreen-pipeline
oc create -f .tkn/tasks/task-build-s2i.yaml -n bluegreen-pipeline
oc create -f .tkn/tasks/task-deploy.yaml -n bluegreen-pipeline
oc create -f .tkn/tasks/task-test.yaml -n bluegreen-pipeline
oc create -f .tkn/tasks/task-promote.yaml -n bluegreen-pipeline
oc create -f .tkn/pipeline/pipeline.yaml -n bluegreen-pipeline

Allow the pipeline ServiceAccount to make deploys on other projects

oc policy add-role-to-user edit system:serviceaccount:bluegreen-pipeline:pipeline -n bluegreen-pipeline
oc policy add-role-to-user edit system:serviceaccount:bluegreen-pipeline:pipeline -n bluegreen-dev
oc policy add-role-to-user edit system:serviceaccount:bluegreen-pipeline:pipeline -n bluegreen-test

Import remote image stream

oc import-image quay.io/ecwpz91/bluegreen:latest --confirm -n bluegreen-dev

Configuring periodic importing of image stream tags

oc tag quay.io/ecwpz91/bluegreen:latest bluegreen:v1 --scheduled -n bluegreen-dev
oc tag docker.io/ecwpz91/bluegreen:latest bluegreen:v2 --scheduled -n bluegreen-dev

Add annotations to a Kubernetes deployment

oc set triggers deployment/example-blue --from-image bluegreen:v1 -c example-blue -n bluegreen-dev
oc set triggers deployment/example-green --from-image bluegreen:v2 -c example-green -n bluegreen-dev

Manually trigger image import

oc import-image bluegreen --confirm --all