Skip to content

Latest commit

 

History

History
159 lines (97 loc) · 3.48 KB

readme.adoc

File metadata and controls

159 lines (97 loc) · 3.48 KB

Blue, Green, Canary Deployments

With Tekton pipeline builds

With Istio

Minikube (Incomplete)

curl -L https://github.com/istio/istio/releases/download/1.3.0/istio-1.3.0-osx.tar.gz | tar xz

cd istio-1.3.0

for i in install/kubernetes/helm/istio-init/files/crd*yaml; do kubectl apply -f $i; done

kubectl create -f install/kubernetes/istio-demo.yaml

kubectl create namespace demo

kubectl label namespace demo istio-injection=enabled

kubens demo

./4_service.sh

./5_deploy_blue.sh

./5_deploy_green.sh

./5_deploy_canary.sh

./6_deploy_gateway.sh

watch kubectl get pods

./poll_bgc_minikube_gateway.sh

# Should be alternating across blue/green/canary

kubectl create -f src/main/istio/Destination_rule_blue_green.yml

kubectl replace -f src/main/istio/Virtual_service_blue.yml

Tekton on Minikube

Incomplete


OpenShift

# 16 cores available in worker nodes

# Add the Istio & Tekton
git clone https://github.com/redhat-developer-demos/guru-night

cd guru-night

cp setenv.example setenv.sh

mkdir work

edit setenv.sh

./workshopper installCatalogSources
./workshopper installServicemesh
./workshopper createServicemesh
oc api-resources --api-group='networking.istio.io'
# ./workshopper createUsers
./workshopper installPipelines


# Add kind: ServiceMeshMemberRoll via the Operator UI into namespace istio-system

Pipelines Tekton

oc api-resources --api-group='tekton.dev'

oc get pods -n openshift-pipelines

oc new-project rhd-workshop-infra
oc new-app sonatype/nexus -n rhd-workshop-infra
oc get pods -n rhd-workshop-infra

oc new-project one

git clone https://github.com/burrsutter/blue-green-canary

./4_service.sh


# Declare Resources
oc create -f src/main/tekton/pipeline-resources-openshift.yml

tkn res ls
NAME               TYPE    DETAILS
bgc-git-source     git     url: https://github.com/burrsutter/blue-green-canary
bgc-image-blue     image   url: image-registry.openshift-image-registry.svc:5000/one/blue-green-canary:blue
bgc-image-canary   image   url: image-registry.openshift-image-registry.svc:5000/one/blue-green-canary:canary
bgc-image-green    image   url: image-registry.openshift-image-registry.svc:5000/one/blue-green-canary:green

# Declare Tasks
# yq & kubectl apply
oc apply -f src/main/tekton/task-yq-deploy.yml
# mvn & buildah
oc apply -f src/main/tekton/task-mvn-buildah.yml
oc apply -f src/main/tekton/task-mvn-buildah.yml


tkn task ls
NAME               AGE
mvn-buildah        4 seconds ago
yq-deploy          28 seconds ago

# Declare Pipelines
oc apply -f src/main/tekton/pipeline.yml

tkn pipeline ls
NAME               AGE             LAST RUN   STARTED   DURATION   STATUS
bgc-build-deploy   5 seconds ago   ---        ---       ---        ---

# Check APIResource.java for Aloha/blue

https://github.com/burrsutter/blue-green-canary/blob/master/src/main/java/com/burrsutter/bluegreencanary/APIResource.java

# Start the pipeline
./5_start_pipeline_blue.sh

# Use list_containers.sh

# Change APIResource.java for Bonjour/green
./5_start_pipeline_green.sh

# Change APIResource.java for Hola/canary
./5_start_pipeline_canary.sh

./6_deploy_gateway.sh

watch kubectl get pods

./poll_bgc_ocp4_gateway.sh

# Should be alternating across blue/green/canary

# the URL for your browser
URL=$(kubectl get route istio-ingressgateway -n istio-system --output 'jsonpath={.status.ingress[].host}')/api

# everybody blue
kubectl replace -f src/main/istio/Virtual_service_blue.yml

# everybody green
kubectl replace -f src/main/istio/Virtual_service_green.yml