Upgrade to Pro — share decks privately, control downloads, hide ads and more …

讓 Jenkins 老爺爺掌舵帶領開發者航向美好新世界

Kyle Bai
September 26, 2020

讓 Jenkins 老爺爺掌舵帶領開發者航向美好新世界

Kyle Bai

September 26, 2020
Tweet

More Decks by Kyle Bai

Other Decks in Technology

Transcript

  1. @k2r2bai About Me ⽩凱仁(Kyle Bai) • SRE at AMIS/MaiCoin. •

    AWS Container Hero. • Co-organizer of Cloud Native Taiwan User Group. • Interested in emerging technologies. • Top 3 Kubernetes contributor in Taiwan. https://k8s.devstats.cncf.io GitHub: kairen([email protected]) Blog: https://k2r2bai.com
  2. @k2r2bai Kubernetes • Container orchestration. • Self-healing. • Horizontal scaling.

    • Service discovery and Load balancing. • Automated rollouts and rollbacks. • Secrets and conJguration management. • Storage orchestration. • ....
  3. @k2r2bai Jenkins • An open-source tool with great community suppoL.

    • 1000+ plugins. • Easy to install. • It is built with Java and hence, it is poLable to all the major plaUorms. • Anything you can customize. • Declarative Pipeline(Groovy script). • The Jrst project to graduate in the CD Foundation. • ...
  4. @k2r2bai Developers Git Repository Jenkins Commit/PR Checkout Code and Load

    JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin For unit test, building, deploy
  5. @k2r2bai Jenkins plugin to run dynamic agents in a Kubernetes/Docker

    environment. The agent is essentially a pod. Can conJgure volumes, resources limit, namespaces … and more. h\ps://github.com/jenkinsci/kubernetes-plugin Runtime Agents Kubernetes Plugin
  6. @k2r2bai Jenkins Agent Pod jenkins-agent Docker dind Other Tools Runtime

    Pod Metadata and Spec Runtime Agents Kubernetes Plugin
  7. @k2r2bai Runtime Agents Kubernetes Plugin Auto Scaling Groups Managed By

    Cluster Autoscaler Watch and List pod 1. Pods are in a pending state Max: 6 Desired: 3 Min: 0 MaxSize: 6 MinSize: 0
  8. @k2r2bai Runtime Agents Kubernetes Plugin Auto Scaling Groups Managed By

    Cluster Autoscaler Watch and List pod 1. Pods are in a pending state 2. Cluster Autoscaler requests node Max: 6 Desired: 4 Min: 0 MaxSize: 6 MinSize: 0
  9. @k2r2bai Runtime Agents Kubernetes Plugin Auto Scaling Groups Managed By

    Cluster Autoscaler Watch and List pod 1. Pods are in a pending state Max: 6 Desired: 4 Min: 0 2. Cluster Autoscaler requests node 3. New node in provisioned MaxSize: 6 MinSize: 0
  10. @k2r2bai Developers Git Repository Jenkins Commit/PR Checkout Code and Load

    JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin Instance Agents EC2 Plugin For unit test, building, deploy For e2e, integration, ... , etc
  11. @k2r2bai Instance Agents Amazon EC2 plugin Allow Jenkins to staL

    agents on EC2 on demand, and kill them as they get unused. Can use EC2 Spot Instances for their Jenkins CI pipelines(Cost optimization). Instances are terminated when the idle timeout period expires. h\ps://github.com/jenkinsci/ec2-plugin
  12. @k2r2bai Bootstrapper Abstract Class Options Parser Class Setup() Reset() InstallAddons()

    getKubeletLog() cleanUp() handleSystemTimeout() checkNodes() checkPods()
  13. @k2r2bai Bootstrapper Abstract Class Options Parser Class Setup() Reset() InstallAddons()

    getKubeletLog() cleanUp() handleSystemTimeout() checkNodes() checkPods()
  14. @k2r2bai Options Parser kind(logLevel: 9, name: "e2e", image: "kindest/node:v1.19.0") {}

    kind --verbosity=9 --name="e2e" --image="kindest/node:v1.19.0"
  15. @k2r2bai Developers Git Repository Jenkins Commit/PR Publish reports (Coverage, ...)

    Checkout Code and Load JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin Instance Agents EC2 Plugin For unit test, building, deploy For e2e, integration, ... , etc
  16. @k2r2bai Developers Git Repository Jenkins Commit/PR Publish reports (Coverage, ...)

    Checkout Code and Load JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin Instance Agents EC2 Plugin Build Images (For deploy) Merged For unit test, building, deploy For e2e, integration, ... , etc
  17. @k2r2bai Developers Git Repository Jenkins Commit/PR Publish reports (Coverage, ...)

    Checkout Code and Load JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin Instance Agents EC2 Plugin Build Images (For deploy) Scan Images Merged For unit test, building, deploy For e2e, integration, ... , etc Success Check CVE reports
  18. @k2r2bai Developers Git Repository Jenkins Commit/PR Publish reports (Coverage, ...)

    Checkout Code and Load JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin Instance Agents EC2 Plugin Build Images (For deploy) Scan Images Merged For unit test, building, deploy For e2e, integration, ... , etc Success Check CVE reports Publish reports to Jenkins
  19. @k2r2bai Developers Git Repository Jenkins Commit/PR Publish reports (Coverage, ...)

    Checkout Code and Load JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin Instance Agents EC2 Plugin Build Images (For deploy) Scan Images Merged For unit test, building, deploy For e2e, integration, ... , etc Success Push images Check CVE reports
  20. @k2r2bai Developers Git Repository Jenkins Commit/PR Publish reports (Coverage, ...)

    Checkout Code and Load JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin Instance Agents EC2 Plugin Build Images (For deploy) Scan Images Merged For unit test, building, deploy For e2e, integration, ... , etc Success Push images Check CVE reports Deploy Success kubectl helm . . .
  21. @k2r2bai Developers Git Repository Jenkins Commit/PR Publish reports (Coverage, ...)

    Checkout Code and Load JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin Instance Agents EC2 Plugin Build Images (For deploy) Scan Images Merged For unit test, building, deploy For e2e, integration, ... , etc Success Push images Check CVE reports Deploy Success kubectl helm . . .
  22. @k2r2bai Developers Git Repository Jenkins Commit/PR Publish reports (Coverage, ...)

    Checkout Code and Load JenkinsGles Run tests (unit, e2e, ...) Trigger build Run pipeline Runtime Agents Kubernetes Plugin Instance Agents EC2 Plugin Build Images (For deploy) Scan Images Merged For unit test, building, deploy For e2e, integration, ... , etc Success Push images Check CVE reports Deploy Success kubectl helm . . . k8s API creds Git creds k8s API creds AWS creds Registry creds Registry creds
  23. @k2r2bai GitOps is a way of implementing Continuous Deployment for

    cloud native applications. It focuses on a developer-centric experience when operating infrastructure, by using tools developers are already familiar with, including Git and Continuous Deployment tools. • The entire system described declaratively. • The canonical desired system state versioned in Git. • Approved changes that can be automatically applied to the system. • Software agents to ensure correctness and alert on divergence. GitOps
  24. @k2r2bai To start managing your cluster with GitOps workflows, the

    following must be in place: • The entire system described declaratively. • The canonical desired system state versioned in Git. • Approved changes that can be automatically applied to the system. • Software agents to ensure correctness and alert on divergence. Principles of GitOps
  25. @k2r2bai The pull request (PR) is the foundation of Jenkins

    X CI/CD pipeline execution. In PRs, Jenkins X allows developers and reviewers to: • Verify changes. • Review PR code changes and their effects. • Approve or deny PRs or suggest changes. • Approve PRs and trigger automatic merge and promotion. • Manual promotion of PRs to production environments and software releases. ChatOps