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

Cloud-native pipeline with Tekton

Cloud-native pipeline with Tekton

Alex Khaerov

January 27, 2020
Tweet

More Decks by Alex Khaerov

Other Decks in Programming

Transcript

  1. Sample App Web Service 1 Web Service 2 http request

    http response http request http response
  2. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  3. • Kubernetes Style Resources ⇔ Tekton Custom Resources • Declaring

    CI/CD Pipelines ⇔ Tekton Controllers Manages State
  4. “Kubernetes resource model is coming to an API near you!”

    - Kubernetes-style APIs of the Future, Daniel Smith KubeCon CloudNativeCon Europe, May 2018
  5. API Operations Resources • Pods • Deployments • Service •

    Node • ... Verbs • Get • List • Create • Update • Delete • Patch • Watch
  6. • Pods • Deployments • Service • Node • …

    • Custom Resources • Get • List • Create • Update • Delete • Patch • Watch API Operations Resources Verbs
  7. State Controllers • Split System State into small pieces •

    Separate Controllers manage each piece Resource State Controller Events
  8. • Split System State into small pieces • Separate Controllers

    manage each piece Resource State Controller Events Yes!, we can add custom controllers :) State Controllers
  9. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  10. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  11. Task • Defines the work that needs to be executed

    • Every task runs as a Pod • Contains multiple steps
  12. Steps (in a Task) • Series of commands • Sequentially

    executed by the task. • Each step in a task runs as a container Task step step step
  13. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  14. PipelineResource • Predefined input/output • System defined resource types ready

    to use • Decoupled and reusable • Commonly used PipelineResource types: image, git
  15. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  16. Pipeline • Defines list of Tasks to execute • Expresses

    Task order (graph) • Links Tasks inputs and outputs Pipeline Task Task Task Task Task
  17. TaskRun • Instance of a defined Task • Binds the

    inputs/outputs to a Task • Sets values to the parameters • Executes Task steps
  18. PipelineRun • Instance of a defined Pipeline • Binds inputs/outputs

    to a Pipeline • Execute the Tasks in the Pipeline • Create the TaskRuns for each Task and collect the results
  19. Sample App Web Service 1 Web Service 2 http request

    http response http request http response
  20. CI/CD Pipeline Build Web Service 1 (Task) Build Web Service

    2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline) source code (PipelineResource) source code (PipelineResource) execution order inputs
  21. Build Task Pull source code (Step) Build container Image (Step)

    Push container image (Step) (Task) source code (PipelineResource) container image (PipelineResource) execution order inputs
  22. Deployment Task Update Deployment manifest (Step) Create Deployment (Step) (Task)

    container image (PipelineResource) Functional web services execution order inputs
  23. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  24. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  25. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  26. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  27. source code (PipelineResource) source code (PipelineResource) execution order inputs CI/CD

    Pipeline Build Web Service 1 (Task) Build Web Service 2 (Task) Deploy Web Service 1 (Task) Deploy Web Service 2 (Task) container image (PipelineResource) container image (PipelineResource) (Pipeline)
  28. tkn (Tekton CLI) Available Commands • task : Manage tasks

    • taskrun : Manage taskruns • pipeline : Manage pipelines • pipelinerun : Manage pipelineruns • completion : Prints shell completion scripts • help : Help about any command • version : Prints version information
  29. tkn task Available Sub-Commands • list : Lists tasks in

    a namespace tkn taskrun Available Sub-Commands • list : Lists taskruns in a namespace • logs : Displays taskrun logs
  30. tkn pipeline Available Sub-Commands • describe : Describes a pipeline

    in a namespace • list : Lists pipelines in a namespace • start : Start pipelines by creating a pipelinerun in a namespace tkn pipelinerun Available Sub-Commands • describe : Describe a pipelinerun in a namespace • list : Lists pipelineruns in a namespace • logs : Display pipelinerun logs