pipeline delivery continuous€¦ · microservices requirements *** automation *** automation is...

74
CONTINUOUS DELIVERY PIPELINE

Upload: others

Post on 23-May-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

CONTINUOUS DELIVERY PIPELINE

Page 2: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Rodrigo BottiBackend, Frontend, Ops, Fullstack (?)

NEXA: Integrations Team - Crawler, APIs, Ops, Fullstack (?)

GDG Campinas: Organizer

Page 3: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 4: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

AGENDA

▸ Current Scenario▸ Continuous Delivery▸ Canary Release▸ Tooling▸ Future▸ Q&A

Page 5: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

!!! DISCLAIMER !!!

Page 6: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 7: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

1.SCENARIO

TechnologyPlatforms

Page 8: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

MAINTECHNOLOGIES

Page 9: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

MAINTECHNOLOGIES

Page 10: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

MICROSERVICESAdvantages

MODULARITY

Reduced codebase, easier to reason about, develop, test and deploy.

Single responsibility.

PARALLELISM

Multiple teams working on separate services.

SCALABLE

Faster feature delivery.

Independent horizontal/vertical scaling and failure handling.

Page 11: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

MICROSERVICESRequirements

*** AUTOMATION ***

Automation is key for having speed, scalability / elasticity specially when dealing with a distributed services application.

DISCOVERY

Service discovery by name: cloud-level DNS, service-mesh level DNS, registration, client-side load balancing.

OBSERVABILITY

Monitoring, metrics/health gathering, central tracing, APM, alarm management.

Avoid "needle in a haystack" debugging.

Page 12: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 13: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

MICROSERVICESAnatomy (Kubernetes)

▸ Deployment▹ Pod: Container (Image) + Resource limits▹ Replica set: count + deploy strategy

▸ Service▹ Deployment load balancer▹ Ingress traffic

▸ HorizontalPodAutoScaler▹ Deployment replica set horizontal scaling

▸ ServiceMonitor▹ Prometheus metrics exporter

▸ Ingress (*)▹ Cluster gateway L7 router

Page 14: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

MICROSERVICESAnatomy (Kubernetes)

Service AService B

Pod A 1Pod A 2Pod B 3 Pod B 2 Pod B 1

Ingress

<domain>/svc-b <domain>/svc-a

External Traffic

Page 15: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

SHOW ME THE CODE!

Page 16: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Deployment

Page 17: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Service HPA

Page 18: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Ingress SVC Monitor

Page 19: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 20: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

2.CONTINUOUSDELIVERY

ConceptPipeline

Page 21: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

“Produce software in short cyclesReliably released at any timeBuilding, testing and releasing faster and more frequentlyStraightforward and repeatable deployment process

Page 22: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

PIPELINE

Code Push + Webhook

Lint

Test + Coverage

Quality Metrics Check

Build + Push Image

Deploy (Canary, Blue/Green, etc)

Page 23: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

3.CANARYRELEASE

ConceptPipeline

Page 24: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 25: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

PIPELINE

Deploy QA Environment (Homolog)

Deploy Baseline

Canary Analysis

Deploy Canary

Delete BaselineDelete Canary

Deploy Production( Rolling )

Success/Error

Page 26: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

4.TOOLS

TopologyAutomation Server

Integration TestsCode Quality

DeployCanary

Page 27: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Webhook

Code Quality Check(REST calls)

DeployTrigger CD

Canary Analysis

Page 28: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

(LEEEROOOOOOOOOY...)JENKINS

▸ Automation Server▸ Pipeline▸ Groovy DSL▸ Plugins

Page 29: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

(LEEEROOOOOOOOOY...)JENKINS

▸ Kubernetes Plugin▸ Custom Library▸ Opinionated DSL

Page 30: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 31: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

App Test Pod

App Container DB Container Cache Container

Page 32: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

SHOW ME THE CODE!

Page 33: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Pipeline

Page 34: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

DSL

Page 35: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

DSL

Page 36: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

DSL

Page 37: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

DSL

Page 38: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Running Pipeline Pod

Page 39: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

QUALITY CHECKSSONARQUBE

▸ Quality Metrics▹ Code smells▹ Bugs▹ Vulnerabilities▹ Code coverage

▸ Quality Profiles▸ Quality Gate

Page 40: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 41: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 42: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

MONITORINGPROMETHEUS (OPERATOR)

▸ Monitoring▸ Time-series database▸ PromQL▸ Alerting

Page 43: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 44: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

DELIVERYSPINNAKER

▸ CD Pipeline▸ Canary Release▸ Multi-cloud

▹ Kubernetes▸ Abstracts infrastructure elements (*)▸ Netflix

Page 45: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

WEBUI

CanaryAnalysis

Page 46: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 47: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 48: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

CONCEPTS/ABSTRACTIONSSPINNAKER

▸ Application▸ Cluster▸ Server Group▸ Load Balancer

▸ Application▸ Cluster == Namespace▸ Server Group == Deployment▸ Load Balancer == Service

Page 49: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 50: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

PIPELINE

Deploy QA Environment (Homolog)

Deploy Baseline

Canary Analysis

Deploy Canary

Delete BaselineDelete Canary

Deploy Production( Rolling )

Success/Error

Page 51: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

PIPELINE

Full Manifest N = homolog

DeploymentN = prod, L = baseline

Canary AnalysisComparing pods: canary vs baseline

DeploymentN = prod, L = canary

Delete DeploymentsN = prod, L = [baseline, canary]

Full ManifestN = prod

Success/ErrorCheck canary stage result

Page 52: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 53: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Pipeline Overview

Page 54: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Stage: Configuration

Page 55: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Stage: Canary Analysis

Page 56: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Canary Config

Page 57: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Canary ConfigMetric

Page 58: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Canary ConfigFilter

Page 59: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Canary Analysis Report: Success

Page 60: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Canary Analysis Report: Failed

POD NOT UP (ENV VAR ERROR)

Page 61: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

Stage: Check

Page 62: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

5.FUTURE

Page 63: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

P.O.C.

kubernetes-cluster-sa-east

namespace: spin namespace: jenkins namespace: production

Spinnaker:

DeckGateKayenta...

* in single box for diagram simplicity

Jenkins master

Jenkins agent

Jenkins job slave

Jenkins job slave

feature toggle

profiles

labs-properties

Page 64: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

ONGOINGk8s-cd-cluster-us-east

namespace: spin namespace: jenkins

Spinnaker Jenkins

k8s-app-cluster-us-east

namespace: production

GKE

namespace: default

migrated migrating

Page 65: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

ONGOING

▸ Migrating CIs to Jenkins▹ Wercker▹ * CircleCI *▹ Saves $ + Higher concurrency▹ Standardizes pipeline and quality measures

▸ Jenkins pushing to both registries▹ ECR▹ GCR

▸ Spinnaker aware of both clusters▸ Kayenta metrics

▹ Response time▹ Error rates▹ Resource consumption

Page 66: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

FUTURE

▸ Canary Analysis config improvement▹ What metrics?▹ Groups weights▹ Length/Windows

▸ Service Mesh?▸ Manifests from SCM▸ Pipeline in SCM▸ Canary Analysis with business metrics

▹ Custom collector?▸ Automatic feature toggle management

Page 67: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 68: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

6.Q&A

Page 69: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

7."THANK YOU"NOTES

Page 70: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 71: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

https://liviasaude.com.br

Page 72: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 73: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed
Page 74: PIPELINE DELIVERY CONTINUOUS€¦ · MICROSERVICES Requirements *** AUTOMATION *** Automation is key for having speed, scalability / elasticity specially when dealing with a distributed

[email protected]

[email protected]

https://www.linkedin.com/in/rodrigo-botti/