Blue-Green Deployments with Spinnaker: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 58: Line 58:
Add stage → Deploy (Manifest). Stage name: "Deploy in Stage". This stage will deploy the Helm chart and associate the workload with the "stage" service. For more details, see: {{Internal|Spinnaker_Stage_Deploy_(Manifest)#Overview|Deploy (Manifest)}}
Add stage → Deploy (Manifest). Stage name: "Deploy in Stage". This stage will deploy the Helm chart and associate the workload with the "stage" service. For more details, see: {{Internal|Spinnaker_Stage_Deploy_(Manifest)#Overview|Deploy (Manifest)}}


At this stage, we don't enable Rollout Strategy Options, as we are not interested in preserving a previous stage workload.
At this stage, we do enable Rollout Strategy Options, so we can associate the workload with the "stage" service.
 
Enable: "Spinnaker manages traffic based on your selected strategy" → Service(s) Namespace → Service(s): "stage" → Traffic: Send client requests to new pods → Strategy: Highlander.


Add stage → Manual Judgement. Stage name: "Wait on Stage Testing"
Add stage → Manual Judgement. Stage name: "Wait on Stage Testing"
Add stage → Deploy (Manifest). Stage name: "Deploy in Prod". This stage will deploy the same Helm chart that was tested in Stage and associate the workload with the "prod" service. For more details, see: {{Internal|Spinnaker_Stage_Deploy_(Manifest)#Overview|Deploy (Manifest)}}
At this stage, we do enable Rollout Strategy Options:
Enable: "Spinnaker manages traffic based on your selected strategy"


=Organizatorium=
=Organizatorium=

Revision as of 04:25, 9 March 2022

External

Internal

Overview

This article documents a pipeline that deploys a release in a Stage environment, waits for testing, the deploys the same release in Prod. The application is a Helm-packaged Kubernetes application, but some of the Kuberentes resources are created manually directly in Spinnaker.

Create Services

Create two Services ("stage" and "prod") within the Spinnaker Application.

Load Balancers → Create Load Balancer

Select the right "account" (Kubernetes cluster)

Manifest (do not forget to adjust the namespace):

apiVersion: v1
kind: Service
metadata:
  name: stage
  namespace: of02
spec:
  type: ClusterIP
  selector:
    stage: 'true' # this label will be dynamically applied to the workload pods
  ports:
    - port: 8080
      name: http
      targetPort: 8080
apiVersion: v1
kind: Service
metadata:
  name: prod
  namespace: of02
spec:
  type: ClusterIP
  selector:
    prod: 'true' # this label will be dynamically applied to the workload pods
  ports:
    - port: 8080
      name: http
      targetPort: 8080


Create the Pipeline

It will be a "deploy to stage → manual testing → manual judgement → deploy to prod" pipeline.

Name: "Stage - Manual Testing - Prod" (no "→" allowed in name)

Add stage → Bake (Manifest). Stage name: "Render Helm Chart". This stage will render the helm chart, apply the configuration overlay and overwrite the image tag. For more details, see:

Bake (Manifest)

Add stage → Deploy (Manifest). Stage name: "Deploy in Stage". This stage will deploy the Helm chart and associate the workload with the "stage" service. For more details, see:

Deploy (Manifest)

At this stage, we do enable Rollout Strategy Options, so we can associate the workload with the "stage" service.

Enable: "Spinnaker manages traffic based on your selected strategy" → Service(s) Namespace → Service(s): "stage" → Traffic: Send client requests to new pods → Strategy: Highlander.

Add stage → Manual Judgement. Stage name: "Wait on Stage Testing"

Add stage → Deploy (Manifest). Stage name: "Deploy in Prod". This stage will deploy the same Helm chart that was tested in Stage and associate the workload with the "prod" service. For more details, see:

Deploy (Manifest)

At this stage, we do enable Rollout Strategy Options:

Enable: "Spinnaker manages traffic based on your selected strategy"

Organizatorium

TO PROCESS: