|  | 
| 1 |  | -# Tektoncd Pruner Controller | 
|  | 1 | +<!-- | 
| 2 | 2 | 
 | 
| 3 |  | -Tektoncd pruner is a project to manage executed `pipelinerun` and `taskrun`. | 
|  | 3 | +--- | 
|  | 4 | +title: "Tekton resource pruning based on predefined configuration" | 
|  | 5 | +linkTitle: "Tekton Resource Pruning" | 
|  | 6 | +weight: 10 | 
|  | 7 | +description: Configuration based event driven pruning solution for Tekton | 
|  | 8 | +cascade: | 
|  | 9 | +  github_project_repo: https://github.com/openshift-pipelines/tektoncd-pruner | 
|  | 10 | +--- | 
|  | 11 | +--> | 
|  | 12 | + | 
|  | 13 | +# Tekton Pruner | 
|  | 14 | + | 
|  | 15 | +TO BE UPDATED [](https://bestpractices.coreinfrastructure.org/projects/6408) | 
|  | 16 | + | 
|  | 17 | +Event based pruning of Tekton resources | 
|  | 18 | + | 
|  | 19 | +<p align="center"> | 
|  | 20 | +<img src="tekton_chains-color.png" alt="Tekton Pruner logo"></img> | 
|  | 21 | +</p> | 
|  | 22 | + | 
|  | 23 | +## Getting Started | 
|  | 24 | + | 
|  | 25 | +Tekton Pruner is a controller that continuously monitors a predefined configuration in a ConfigMap and | 
|  | 26 | +removes PipelineRuns and TaskRuns according to the specified settings. | 
|  | 27 | + | 
|  | 28 | +By default, the Pruner controller watches the ConfigMap tekton-pruner-default-spec. Additionally,  | 
|  | 29 | +it includes two other controllers that monitor every PipelineRun and TaskRun event in the cluster,  | 
|  | 30 | +continuously reconciling to remove them based on the ConfigMap settings. | 
|  | 31 | + | 
|  | 32 | +<p align="center"> | 
|  | 33 | +<img src="docs/images/pruner_functional_abstract.png" alt="Tekton Pruner overview"></img> | 
|  | 34 | +</p> | 
|  | 35 | + | 
|  | 36 | +Current Features: | 
|  | 37 | + | 
|  | 38 | +1. Ability to set a cluster-wide pruning configuration that applies to all namespaces in the cluster. | 
|  | 39 | + | 
|  | 40 | +   Pruning Configuration Variations (Prioritized from Highest to Lowest): | 
|  | 41 | + | 
|  | 42 | +   - Pruning PipelineRuns and TaskRuns based on TTL (time-to-live) in seconds.`ttlSecondsAfterFinished` | 
|  | 43 | +   - Defining the number of successful PipelineRuns/TaskRuns to retain.`successfulHistoryLimit` | 
|  | 44 | +   - Defining the number of failed PipelineRuns/TaskRuns to retain.`failedHistoryLimit` | 
|  | 45 | +   - Setting a fixed number of PipelineRuns/TaskRuns to retain, regardless of status.`historyLimit` | 
|  | 46 | + | 
|  | 47 | +   sample configMap depiciting the above settings that apply to all namespaces in the cluster | 
|  | 48 | + | 
|  | 49 | +   ```yaml | 
|  | 50 | +    apiVersion: v1 | 
|  | 51 | +    kind: ConfigMap | 
|  | 52 | +    metadata: | 
|  | 53 | +        name: tekton-pruner-default-spec | 
|  | 54 | +        namespace: tekton-pipelines | 
|  | 55 | +    data: | 
|  | 56 | +        global-config: | | 
|  | 57 | +            ttlSecondsAfterFinished: 600 # 5 minutes | 
|  | 58 | +            successfulHistoryLimit: 3  | 
|  | 59 | +            failedHistoryLimit: 3 | 
|  | 60 | +            historyLimit: 5   | 
|  | 61 | +   ``` | 
|  | 62 | +
 | 
|  | 63 | +Work In Progress Features: | 
|  | 64 | +
 | 
|  | 65 | +2. Ability to set pruning configuration specific to a Namespace that can overrides the cluster-wide settings | 
|  | 66 | +
 | 
|  | 67 | +3. Ability to set pruning configuration specific to PipelineRuns/TaskRuns that can be identified either by  | 
|  | 68 | +      - Parent Pipleline/Task Name  | 
|  | 69 | +      - Matching Labels | 
|  | 70 | +      - Matching Annotations | 
|  | 71 | +   This configurations override the Namespace specific configuration | 
|  | 72 | +
 | 
|  | 73 | +
 | 
|  | 74 | +### Installation **TO BE UPDATED** | 
|  | 75 | +
 | 
|  | 76 | +Prerequisite: you'll need | 
|  | 77 | +[Tekton Pipelines](https://github.com/tektoncd/pipeline/blob/main/docs/install.md) installed on your cluster before you install Pruner. | 
|  | 78 | +
 | 
|  | 79 | +To install the latest version of Pruner to your Kubernetes cluster, run: | 
|  | 80 | +
 | 
|  | 81 | +```shell | 
|  | 82 | +kubectl apply --filename ??release.yaml | 
|  | 83 | +``` | 
|  | 84 | + | 
|  | 85 | +To install a specific version of Chains, run: | 
|  | 86 | + | 
|  | 87 | +```shell | 
|  | 88 | +kubectl apply -f ??release.yaml | 
|  | 89 | +``` | 
|  | 90 | + | 
|  | 91 | +To verify that installation was successful, wait until all Pods have Status | 
|  | 92 | +`Running`: | 
|  | 93 | + | 
|  | 94 | +```shell | 
|  | 95 | +kubectl get po -n tekton-pipelines --watch | 
|  | 96 | +``` | 
|  | 97 | + | 
|  | 98 | +``` | 
|  | 99 | +NAME                                          READY   STATUS      RESTARTS   AGE | 
|  | 100 | +tekton-pruner-controller-5756bc7cb9-lblnx      1/1     Running      0        10s | 
|  | 101 | +``` | 
|  | 102 | + | 
|  | 103 | +### Setup **WIP** | 
|  | 104 | + | 
|  | 105 | +To view and edit the default configuartions: | 
|  | 106 | + | 
|  | 107 | +- [Set up any additional configuration](docs/config.md) | 
|  | 108 | + | 
|  | 109 | +## Tutorials **WIP** | 
|  | 110 | + | 
|  | 111 | +To get started with pruner, try out our | 
|  | 112 | +[getting started tutorial](docs/tutorials/getting-started-tutorial.md). | 
|  | 113 | + | 
|  | 114 | +## Want to contribute - TO BE UPDATED | 
|  | 115 | + | 
|  | 116 | +We are so excited to have you! | 
|  | 117 | + | 
|  | 118 | +- See [CONTRIBUTING.md](CONTRIBUTING.md) for an overview of our processes | 
|  | 119 | +- See [DEVELOPMENT.md](DEVELOPMENT.md) for how to get started | 
|  | 120 | +- See [ROADMAP.md](ROADMAP.md) for the current roadmap Check out our good first | 
|  | 121 | +  issues and our help wanted issues to get started! | 
|  | 122 | +- See [releases.md](releases.md) for our release cadence and processes | 
0 commit comments