Skip to content

Commit 84d8cd9

Browse files
Includes refactored code and bug fixes
1 parent 8d23a20 commit 84d8cd9

File tree

9 files changed

+281
-358
lines changed

9 files changed

+281
-358
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
bazel-*
1111
*.out
1212
builds
13-
.gopath
13+
.gopath
14+
.bin

.golangci.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ linters-settings:
77
exclude-generated: true
88
errcheck:
99
exclude-functions:
10-
- (*github.com/openshift-pipelines/tektoncd-pruner/vendor/go.uber.org/zap.SugaredLogger).Sync
10+
- (*github.com/tektoncd/pipeline/vendor/go.uber.org/zap.SugaredLogger).Sync
1111
- flag.Set
1212
- os.Setenv
1313
- logger.Sync
1414
- fmt.Fprintf
1515
- fmt.Fprintln
1616
- (io.Closer).Close
17+
- updateConfigMap
1718
gomodguard:
1819
blocked:
1920
modules:
@@ -65,15 +66,10 @@ issues:
6566
# Enable off-by-default rules for revive requiring that all exported elements have a properly formatted comment.
6667
- EXC0012 # https://golangci-lint.run/usage/false-positives/#exc0012
6768
- EXC0014 # https://golangci-lint.run/usage/false-positives/#exc0014
68-
exclude-files:
69-
- .*/zz_generated.deepcopy.go
70-
exclude-dirs:
71-
- vendor
72-
# run:
73-
# issues-exit-code: 1
74-
# build-tags:
75-
# - e2e
76-
# timeout: 20m
77-
# modules-download-mode: vendor
78-
# skip-dirs:
79-
# - vendor
69+
run:
70+
issues-exit-code: 1
71+
build-tags:
72+
- e2e
73+
timeout: 20m
74+
modules-download-mode: vendor
75+

README.md

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,122 @@
1-
# Tektoncd Pruner Controller
1+
<!--
22
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 [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/6408/badge)](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
169 KB
Loading

0 commit comments

Comments
 (0)