Share
Embed
Transcript
40 slides
-
ࣗݾհ - ৬ྺ @CyberAgent • PipeCDΛ։ൃɾӡ༻ - DPࣨ • Work
fl ow Automation SystemΛ։ൃɾӡ༻ - OSSS • Feature Flags/Experimentation SystemΛ։ൃɾӡ༻ - AbemaTV • PrometheusͰMonitoring SystemΛߏஙɾӡ༻ - AbemaTV • Deployment ToolΛ։ൃɾӡ༻ - AbemaTV • Microservicesɾج൫पΓͷࣄ - AbemaTV ΄ͱΜͲج൫ϓϥοτϑΥʔϜͷ͜ͱ 3 -
ࠓճ͓͢͠Δ༰ • CI/CDجຊͷೝࣝ߹Θͤ • PipeCDͱ • ͳͥPipeCDΛ࡞͍ͯ͠Δͷ͔ • PipeCDͰͰ͖Δ͜ͱ •
CyberAgentͰPipeCDͷར༻ঢ়گ • PipeCDͷࠓޙϩʔυϚοϓ 5 -
CI != CD When people say “CI/CD,” they are only
talking about Continuous Integration. Nobody is talking about (or practicing) Continuous Deployment. AT ALL. It’s like we have all forgotten it exists. It's time to change that. Charity Majors 8 -
CI != CD Artifact Storage Verifying and Analysing the Impact
Application Code (.go, .java, .js...) Infrastructure Code (.tf ...) Con fi guration Code (.yaml ...) DockerHub, GCR, ECR... GCS, S3... Git Repository Code Storage Actions Continuous Integration Test Code Git Repository Host Environment Artifact Continuous Delivery Artifact Build and Save Artfacts Cloud User Low-risk actions including release strategy, rollback Deployment Dependency Management Provisioning, Installing Artifact 9 Artifact = Docker Image, Helm Chart, Kustomization Module, Terraform Module, ... -
Continous Delivery != Continuous Deployment Continuous Deployment means that every
change goes through the pipeline and automatically gets put into production, resulting in many production deployments every day. In order to do Continuous Deployment we must be doing Continuous Delivery. Continuous Delivery just means that you are able to do frequent deployments but may choose not to do it, usually due to businesses preferring a slower rate of deployment. Artifact Continuous Deployment Dev, Test Env Artifact Continuous Delivery Prod Env An example 10 https://martinfowler.com/bliki/ContinuousDelivery.html -
Deploy != Release Deployment is the process for installing the
new version of artifact on prod environment. When we say a new version of software is deployed, we mean it is running somewhere in the production environment. Releasing is the process of moving production tra ff i c to the new version. When we say a version of a software is released, we mean that it is responsible for serving production tra ff i c. Deployment need not expose customers to a new version of your service. Given this definition, deployment can be an almost zero-risk activity. Turbine Labs 11 https://blog.turbinelabs.io/deploy-not-equal-release-part-one-4724bc1e726b -
PipeCDͱ A uni fi ed continous delivery solution for multiple
application kinds on multi-cloud A gitops tool that enables doing deployment operations by pull request on Git An open source project 12 -
PipeCDͱ 13 - A uni fi ed continous delivery solution
for multiple application kinds on multi-cloud - A gitops tool that enables doing deployment operations by pull request on Git - An open source project -
PipeCD ❤ OSS 14 Thanks to the contributors of PipeCD!
https://pipecd.dev/ https://github.com/pipe-cd/pipe https://pipecd.dev/docs/ - 2020/10݄ʹOSSͱͯ͠ϦϦʔε͠·ͨ͠ - 4ਓ͕ϑϧλΠϜͰPipeCDίϛοτ͍ͯ͠Δ - 22 contributors͔Β1200 PRʹୡ͠·ͨ͠ -
ͳͥPipeCDΛ࡞ͨ͠ͷ͔ Need of a uni fi ed delivery system Easy
to operate multi-tenancy for multiple projects Easy to manage a large number of applications with a good DX Existing solutions do not fi t our requirements 15 -
౷ҰͳσϦόϦγεςϜ͕ඞཁ Project 1 CircleCI 16 Consistency Flexibility • ౷ҰͳγεςϜʹͳΔͱPlatform Team͕😊😊ɺDevelopers͕😊😥
• ౷ҰͳγεςϜͰ͕͢ɺDevelopersͷFlexibilityͷอূ͕ඞཁ • ༷ʑͳΞϓϦέʔγϣϯछྨͷαϙʔτ͕ඞཁ • Kubernetes, Terraform, CloudRun, Lambda, ECS • GCP, AWS, Azure, Private Cloud • ࣗͰ࣮͢ΔϩδοΫͰಈ͚Δ • ͲͷϓϩδΣΫτɾνʔϜͰϫʔΫ͢Δ͜ͱ͕ඞཁ • ͲͷنͰϫʔΫ (3ਓνʔϜ͔Β100ਓνʔϜ·Ͱ) • νʔϜؒʹҠಈ࣌ͷΦϯϘʔσΟϯάίετ͕ແ͠ Project 2 Manually Project 4 FluxCD Project 25 Terraform Cloud + AWS Code Deploy + ArgoCD Project 3 Spinnaker ... Have to fi nd a good balance લͷঢ়ଶ -
Multi-Tenancyͷӡ༻͍͢͠ͷ͕ඞཁ 17 • ωοτϫʔΫͷ੍ݶνʔϜαϙʔτඞཁ • Private cloudͳͲɺ֎͔Βͷ௨৴੍͕ݶ • SecretσʔλΛνʔϜͷΫϥελͷ֎ʹஔ͔ͳ͍ •
RBACɾACLͷίϯτϩʔϧ͍͢͠ • Platform TeamͱDevelopersͷׂͱ͖ͬΓׂ • Platform TeamγεςϜӡ༻ɾϓϥΫςΟεΛීٴ • Developersར༻ɾϑΟʔυόοΫ 25 projectsҎ্ -
طଘͷιϦϡʔγϣϯ͕ຬͨ͞ͳ͍ 18 ӡ༻ͷେม͞ ֶशίετ GitOpsͰͳ͍ʢඞਢͰͳ͍͕😊ʣ Visibilityͷ (UIͳ͠ͳͲʣ Kubernetes ApplicationͷΈ Multi-Tenancyӡ༻ͰΓͳ͍
ඪ४ͳDeploymentͷΘΓʹɺRollout CRDʹมߋඞཁ Kubernetes ApplicationͷΈ Multi-Tenancyӡ༻ͰΓͳ͍ Developer͕୭ͰࣗͷαʔϏεΛߴɾ҆શɾ ҆৺ͰσϓϩΠͰ͖Δ (σϓϩΠதʹkubectlΛશ͘Θͳ͍͍ͯ͘😊ʣ -
PipeCDͰͰ͖Δ͜ͱ Quick Sync and Progressive Sync Automated Rollback Automated Deployment
Analysis Con fi guration Drift Detection Secret Management Event Watcher Noti fi cation 19 -
Quick Sync vs Progressive Sync 20 Sync GitOpsͷҙਤ Quick SyncClusterͷঢ়ଶΛGitͷঢ়ଶΛಉظ͢ΔͨΊʹɺ͙͢Gitͷঢ়ଶભҠ
Progressive SyncClusterͷঢ়ଶΛGitͷঢ়ଶΛಉظ͢Δ్தʹɺઓུ (canary, bluegreen, analysis...)ʹΑΓ ͍͔ͭ͘ͷதؒঢ়ଶʹܦ༝͢Δɻ͔͠͠ɺ࠷ޙతʹGitͷঢ়ଶʹભҠ Git Cluster Sync Sync -
Quick Sync vs Progressive Sync 21 Sync Quick SyncClusterͷঢ়ଶΛGitͷঢ়ଶΛಉظ͢ΔͨΊʹɺ͙͢Gitͷঢ়ଶભҠ Progressive
SyncClusterͷঢ়ଶΛGitͷঢ়ଶΛಉظ͢Δ్தʹɺઓུ (canary, bluegreen, analysis...)ʹΑΓ ͍͔ͭ͘ͷதؒঢ়ଶʹܦ༝͢Δɻ͔͠͠ɺ࠷ޙʹGitͷঢ়ଶʹભҠ Git Cluster Sync Sync GitʹApplication directoryʹ.pipe.yamlͰArtifactͷύεɾσϓϩΠख๏ͳͲΛఆٛͰ͖Δ GitOpsͷҙਤ -
Progressive Sync 23 https://github.com/pipe-cd/examples/blob/master/kubernetes/canary/.pipe.yaml PipelineΛهࡌ͢Δ߹PipeCDͷPlanner͕มߋ༰ʹΑΓQuick Sync͔Progressive SyncΛஅɺྫ: - replicas numberͷมߋͷΈͰɺscaleͷ߹Quick
Sync - pod templateͷมߋͷ߹Progressive Sync - con fi g map/secretͷมߋͷ߹Progressive Sync - deployment͝ͱʹڧ੍Մೳ -
Configuration Drift Detection 26 https://pipecd.dev/docs/user-guide/con fi guration-drift-detection/ • ࣮ࡍͷঢ়ଶ͕ظͷঢ়ଶͱဃ •
Ϣʔβʔ͕ௐ • ଞͷαʔϏε͕ௐ • ࣗಈతʹCon fi guration DriftΛݕ • WebUIͰࠩΛදࣔ • ௨ͰΞϥʔτͷઃఆ͕Մೳ • ݱࡏCon fi guration Drift͕ൃੜ͢Δͱɺ উखʹApply͠ͳ͍ -
Secret Management 27 https://pipecd.dev/docs/user-guide/sealed-secrets/ • GitOpsશͯͷͷΛGitʹอଘ • SecretΛ҆શʹอଘํ๏͕ඞཁ • PipeCDbuilt-in
secretཧํ๏Λ࣋ͭ • Piped agent͕ར༻͢Δલʹ෮ݩΛߦ͏ 1 2 PipeCD webͰSecretͷ҉߸ԽΛߦ͏ ҉߸Խ͞ΕͨσʔλΛGitʹஔ͘ https://blog.stormcat.io/post/pipecd-sealed-secret/ -
Event Watcher 28 FluxCDͷImage Updateػೳͷઆ໌ https://toolkit. fl uxcd.io/guides/image-update/ Container Registry
Git Repository ArgoCD FluxCD Watches images Makes commit to update image tags • GitOpsશͯͷoperation͕Git PRΛ௨ͯ͠Δݪଇ • ৽͍͠container image͕Ͱ͖ͨΒɺࣗಈతʹGitΛߋ৽ -
• GitOpsશͯͷoperation͕Git PRΛ௨ͯ͠Δݪଇ • ৽͍͠container image͕Ͱ͖ͨΒɺࣗಈతʹGitΛߋ৽ • ͜ͷΞϓϩʔνͷ • CI͔ΒCD͢ArtifactContainer
Image͚ͩͰͳͳ͘ • Helm Chart • Kustomization Module • Terraform Module • Etc • աڈͷImage͕ଟ͍߹ʹRegistryͷWatchͷύϑΥʔϚϯε Event Watcher 29 Container Registry Git Repository ArgoCD FluxCD Watches images Makes commit to update image tags -
Event Watcher 30 https://pipecd.dev/docs/user-guide/event-watcher/ pipectl event register \ --name=helloworld-image-update \
--data=gcr.io/pipecd/helloworld:v0.2.0 apiVersion: pipecd.dev/v1beta1 kind: EventWatcher spec: events: - name: helloworld-image-update replacements: - file: helloworld/deployment.yaml yamlField: $.spec.template.spec.containers[0].image spec: containers: - name: helloworld - image: gcr.io/pipecd/helloworld:v0.1.0 + image: gcr.io/pipecd/helloworld:v0.2.0 • PipeCDͰ Image Watcher ΑΓ Event WatcherػೳΛఏڙ • pipectlͰeventΛૹΔ͜ͱͰɺeventʹΑΓGitΛࣗಈతʹम ਖ਼ͯ͘͠ΕΔઃఆ͕Մೳ GitͷதʹeventʹΑΓमਖ਼ͷఆٛ Piped agent͕GitΛमਖ਼ͯ͘͠ΕΔ CIͰҙͷ࣌ؒͰeventΛൃੜ -
Notification 31 https://pipecd.dev/docs/operator-manual/piped/con fi guring-noti fi cations/ • ௨ઌͷઃఆ͕Մೳ •
Slack • Webhook • ௨Πϕϯτͷઃఆ͕Մೳ • Deploymentͷ࣮ߦঢ়ଶ • Con fi guration drift͕ൃੜ • Application Healthͷঢ়ଶ • Pipedͷঢ়ଶ • etc -
୯ҰͳΠϯλϑΣʔεɾ୯Ұͳϓϩηε 32 શͯͷػೳ͕Kubernetes, Terraform, Lambda, CloudRun, ECSͰ͑Δ GCP, AWS, AzureͳͲcloud
providerΛαϙʔτ Prometheus, Datadog, CloudWatch, Stackdriver LoggingͳͲͷσʔλͰੳΛߦ͑Δ -
CyberAgentͰPipeCDͷར༻ঢ়گ The structure of Team and System The numbers at
CyberAgent What we have achieved 33 -
νʔϜͱγεςϜͷߏ 34 • Platform Team • GCP্Ͱશࣾ༻Control-PlaneΛӡ༻ • GCPͷFirestore &
GCSͷϚωδʔυαʔϏεΛར༻ • StatelessͷServer & CacheK8sͷ্ʹಈ͘ • ֤ProjectͷSREs • Single binaryͷPiped agentΛΠϯετʔϧ • K8s cluster or Fargate or VMͷதʹಈ͘ • ֤ProjectͷDevelopers • WebͰ͏ • GitͰPRΛૹͬͯɺσϓϩΠΛߦ͏ -
ಋೖαʔϏε͕૿Ճத 0 100 200 300 400 2020/10 2020/11 2020/12 2021/01
2021/02 2021/03 332 Applications/Services ʢΓͷϓϩδΣΫτҠಈதʣ 35 -
ಋೖͰΑ͔ͬͨ͜ͱ 36 • Platform Team 😊 • શͯͷνʔϜͷσϓϩΠϝϯτΛ౷ҰͰཧ • ϓϥΫςΟεΛ࠾༻ɾීٴ͍͢͠
• ӡ༻ָ͕ • શࣾͷ֤νʔϜ͔ΒϑΟʔυόοΫΛΒ͑Δ • Developers 😊 • kubectlͳͲ͕ෆཁͰɺߴɾ҆શɾ҆৺ͰσϓϩΠ • શͯͷσϓϩΠϝϯτ͕୯ҰͳΠϯλϑΣʔεɾ୯Ұͳϓϩηε • ৽نͷϓϩδΣΫτɾαʔϏεͷಋೖ͕͍ • ΦϯϘʔσΟϯάίετ͕͍ Consistency Flexibility Good Balance -
ࠓޙͷϩʔυϚοϓ • VisibilityΛ্ • Insights: Lead Time, Deployment Frequency, MTTR,
Change Failure RateͳͲΛՄࢹԽ • Applicationͷঢ়ଶΛϦΞϧλΠϜతʹՄࢹԽ • Stage LogΛΑΓΘ͔Γ͘͢ɺΛ͙͢ݟ͑ΔΑ͏ʹ • Multi-Provider, Multi-Tenancy • ECSͷαϙʔτ • ACLͰਂ͍Ϩϕϧͷݖݶཧ • Automated Deployment Analysis: CloudWatch, Stackdriver Logging... • AWS App Mesh, SMI • Secret Management • Sealed secretҎ֎ʹKMS, Vaultαϙʔτ • ࣗ༝Λ্͛ΔͨΊʹɺϢʔβʔͷ࣮ͷpluginΛ࣮ߦͰ͖ΔΑ͏ʹ 38 -
࠷ޙʹ • ࠓޙੵۃతʹ։ൃΛଓ͘ • ۙʹCyberAgentͷશͯͷαʔϏεͰ͑ΔΑ͏ʹීٴͯ͠ߦ͘ • OSSͰެ։ͳͷͰɺશͯͷϑΟʔυόοΫΛܴ • OSSͷࣄʹڵຯ͕͋ΔํɾΠϯλʔϯੜTwitterͷDMΛܴ •
If you like PipeCD or want to support Dev team, give it a star on GitHub! 39