1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-22 06:02:51 +00:00
catalog/task/blue-green-deploy/0.1
Chmouel Boudjnah a861887585 Update all images using openshift to latest stable 4.6
* Update all images to use the latest stable 4.6
* Modify the task using :latest to pin it to 4.6

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
2021-01-05 10:15:11 +00:00
..
samples Add tests for Blue Green Deployment Task 2020-11-03 08:29:22 +00:00
support Add Blue-Green Deployment using K8s 2020-07-30 14:38:02 +01:00
tests Add tests for Blue Green Deployment Task 2020-11-03 08:29:22 +00:00
blue-green-deploy.yaml Update all images using openshift to latest stable 4.6 2021-01-05 10:15:11 +00:00
README.md Fix links in README in Blue Green Deploy task 2020-08-11 12:43:06 +01:00

Blue Green Deploy on Kubernetes

The following task can help you to deploy an application using the Blue-Green deployment strategy. This task gives you the flexibility to deploy a version of the application from the blue zone to the green zone without disturbing the previous version in the blue zone. It works by making the service point to the newer version of the application deployed.

  • If you are deploying the first version of the application then it will go into the blue zone and for that you need to provide deployment and service manifests via the workspaces and in the params the service name and version. Sample Kubernetes manifests for version v1 can be found here.
  • For further new deployments, it will get deployed in the other zone and then the current service will now point to the new deployment. For example if we have a deployment running in the blue zone then we will deploy the next deployment in the green zone and make the service point to the green zone or vice versa.

Installing the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/blue-green-deploy/0.1/blue-green-deploy.yaml

Installing the ClusterRoleBinding

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/blue-green-deploy/0.1/support/clusterrolebinding.yaml

Workspaces

  • manifest-dir: Manifest files can be provided via the workspaces.(Default: emptyDir:{} in case no manifest is provided)
  • kubeconfig-dir: If you want to deploy you application to another cluster then you can mount your kubeconfig file via this workspace. (Default: emptyDir:{} in case kubeconfig is not mounted)

Parameters

Usage

This TaskRun runs the Task to deploy the given Kubernetes resource in the green/blue zone and toggle the service to point to the new zone.

Without using ConfigMap

TaskRun :-

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: blue-green-deploy-run
spec:
  taskRef:
    name: blue-green-deploy-k8s
  params:
    - name: SERVICE_NAME
      value: myapp
    - name: NEW_VERSION
      value: v2
    - name: MANIFEST
      value: "https://raw.githubusercontent.com/tektoncd/catalog/master/task/blue-green-deploy/0.1/samples/v2-deploy/green-deployment.yaml"
  workspaces:
    - name: manifest-dir
      emptyDir: {}

Using ConfigMap

  1. Create the ConfigMap
kubectl create configmap manifests --from-file="green-deployment.yaml"
  1. TaskRun:-
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: blue-green-deploy-run
spec:
  taskRef:
    name: blue-green-deploy-k8s
  params:
    - name: SERVICE_NAME
      value: myapp
    - name: NEW_VERSION
      value: v2
  workspaces:
    - name: manifest-dir
      configMap:
        name: manifests