Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Tekton Pipeline support with pod integration #3898

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion site/content/en/docs/tasks/run/external_workloads/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ You can use AppWrapper, job-based workloads and pod-based workloads.

### Integrations based on built-in frameworks
- [Run a Flux Miniclusters using job integration](/docs/tasks/run/external_workloads/flux_miniclusters).
- [Run an Argo Workflow using pod integration](/docs/tasks/run/external_workloads/pod_based_workloads/argo_workflow).
- [Run an Argo Workflow using pod integration](/docs/tasks/run/external_workloads/argo_workflow).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I was adding this, I realized that argo-workflows was not going to render correctly. Fixed it here.

- [Run a tekton cd pipeline using pod integration](/docs/tasks/run/external_workloads/tektoncd)

63 changes: 63 additions & 0 deletions site/content/en/docs/tasks/run/external_workloads/tektoncd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: "Run A Tekton Pipeline"
linkTitle: "Tekton Pipeline"
date: 2025-02-01
weight: 7
description: >
Integrate Kueue with Tekton Pipelines.
---

This page shows how to leverage Kueue's scheduling and resource management capabilities when running [Tekton pipelines](https://tekton.dev/docs/).

This guide is for [batch users](/docs/tasks#batch-user) that have a basic understanding of Kueue. For more information, see [Kueue's overview](/docs/overview).

We demonstrate how to support scheduling Tekton Pipelines Tasks in Kueue based on the [Plain Pod](/docs/tasks/run_plain_pods) integration, where every Pod from a Pipeline is represented as a single independent Plain Pod.

## Before you begin

1. Learn how to [install Kueue with a custom manager configuration](/docs/installation/#install-a-custom-configured-released-version).

1. Follow the steps in [Run Plain Pods](docs/tasks/run/plain_pods/#before-you-begin) to learn how to enable and configure the `v1/pod` integration.

1. Check [Administrator cluster quotas](/docs/tasks/manage/administer_cluster_quotas/) for details on the initial Kueue step.

1. Your cluster has tekton pipelines [installed](https://tekton.dev/docs/installation/pipelines/).


## Tekton Background

Tekton has the concept of [Pipelines](https://tekton.dev/vault/pipelines-v0.59.x-lts/pipelines/), [Tasks](https://tekton.dev/vault/pipelines-v0.59.x-lts/tasks/) and [PipelineRun](https://tekton.dev/vault/pipelines-v0.59.x-lts/pipelineruns/).

A pipeline consists of tasks. Tasks and pipelines must be created before running a pipeline.

A PipelineRun runs the pipeline.

A TaskRun runs a single task. PipelineRuns will reuse TaskRuns to run each task in a pipeline.

### Tekton Defintions

As a simple example, we will define two tasks named sleep and hello:

{{< include "examples/pod-based-workloads/tekton-sleep-task.yaml" "yaml" >}}

{{< include "examples/pod-based-workloads/tekton-hello-task.yaml" "yaml" >}}

A pipeline composes these tasks.

{{< include "examples/pod-based-workloads/tekton-pipeline.yaml" "yaml" >}}

## a. Targeting a single LocalQueue

If you want every task to target a single [local queue](/docs/concepts/local_queue),
it should be specified in the `metadata.label` section of the PipelineRun configuration.

{{< include "examples/pod-based-workloads/tekton-pipeline-run.yaml" "yaml" >}}

This will inject the kueue label on every pod of the pipeline. Kueue will gate the pods once you are over the quota limits.

## Limitations

- Kueue will only manage pods created by Tekton.
- Each pod in a Workflow will create a new Workload resource and must wait for admission by Kueue.
- There is no way to ensure that a Workflow will complete before it is started. If one step of a multi-step Workflow does not have
available quota, Tekton pipelines will run all previous steps and then wait for quota to become available.
14 changes: 14 additions & 0 deletions site/static/examples/pod-based-workloads/tekton-hello-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: hello
spec:
params:
- name: username
type: string
steps:
- name: hello
image: ubuntu
script: |
#!/bin/bash
echo "Hello $(params.username)!"
13 changes: 13 additions & 0 deletions site/static/examples/pod-based-workloads/tekton-pipeline-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
generateName: kueue-test
labels:
kueue.x-k8s.io/queue-name: my-local-queue
spec:
pipelineRef:
name: kueue-test
params:
- name: username
value: "Tekton"

20 changes: 20 additions & 0 deletions site/static/examples/pod-based-workloads/tekton-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: kueue-test
spec:
params:
- name: username
type: string
tasks:
- name: sleep
taskRef:
name: sleep
- name: hello
runAfter:
- sleep
taskRef:
name: hello
params:
- name: username
value: $(params.username)
12 changes: 12 additions & 0 deletions site/static/examples/pod-based-workloads/tekton-sleep-task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: sleep
spec:
steps:
- name: echo
image: alpine
script: |
#!/bin/sh
sleep 100