Skip to content

Commit 03bd2eb

Browse files
committed
Add TektonResult to TektonConfig doc
This will add the instructions in TektonConfig doc how to install and manage Results component through Tekton Config TektonConfig doc and updates TektonResult doc Signed-off-by: Shiv Verma
1 parent 25e8238 commit 03bd2eb

File tree

2 files changed

+95
-78
lines changed

2 files changed

+95
-78
lines changed

docs/TektonConfig.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Operator provides support for installing and managing following operator compone
1818
Other than the above components depending on the platform operator also provides support for
1919
- On both Kubernetes and OpenShift
2020
- [TektonChain](./TektonChain.md)
21+
- [TektonResult](./TektonResult.md)
2122
- On Kubernetes
2223
- [TektonDashboard](./TektonDashboard.md)
2324
- On OpenShift
@@ -113,6 +114,10 @@ The TektonConfig CR provides the following features
113114
configMaps: {}
114115
deployments: {}
115116
webhookConfigurationOptions: {}
117+
result:
118+
disabled: false
119+
is_external_db: false
120+
options: {}
116121
platforms:
117122
openshift:
118123
pipelinesAsCode:
@@ -165,8 +170,8 @@ By default, namespace would be `tekton-pipelines` for Kubernetes and `openshift-
165170

166171
This allows user to choose which all components to install on the cluster.
167172
There are 3 profiles available:
168-
- `all`: This profile will install all components (TektonPipeline, TektonTrigger and TektonChain)
169-
- `basic`: This profile will install only TektonPipeline, TektonTrigger and TektonChain component
173+
- `all`: This profile will install all components (TektonPipeline, TektonTrigger,TektonResult and TektonChain)
174+
- `basic`: This profile will install only TektonPipeline, TektonTrigger, TektonResult and TektonChain component
170175
- `lite`: This profile will install only TektonPipeline component
171176

172177
On Kubernetes, `all` profile will install `TektonDashboard` and on OpenShift `TektonAddon` will be installed.
@@ -284,6 +289,52 @@ chain:
284289
transparency.url: #value
285290
```
286291
292+
### Result
293+
294+
Result section allows user to customize the Tekton Result component, Refer to [Result Spec](https://github.com/tektoncd/operator/blob/main/docs/TektonResult.md#spec) section in TektonResult for available options.
295+
296+
Default Result configuration in TektonConfig looks like following if user doesn't specified any configuration options
297+
298+
Example:
299+
300+
```yaml
301+
result:
302+
disabled: false
303+
is_external_db: false
304+
options: {}
305+
```
306+
307+
User can customize Result configuration with following options
308+
309+
Example:
310+
311+
```yaml
312+
result:
313+
disabled: false # - `disabled` : if the value set as `true`, result component will be disabled (default: `false`)
314+
targetNamespace: tekton-pipelines
315+
is_external_db: false # By default, this is set to false, TektonOperator will create Tekton Results database. If set to true, an external database will be used, and Tekton Results will retrieve its database credentials from the Kubernetes secret named tekton-results-postgres
316+
db_host: localhost
317+
db_port: 5342
318+
db_sslmode: verify-full
319+
db_sslrootcert: /etc/tls/db/ca.crt
320+
db_enable_auto_migration: true
321+
log_level: debug
322+
logs_api: true
323+
logs_type: File
324+
logs_buffer_size: 90kb
325+
logs_path: /logs
326+
auth_disable: true
327+
logging_pvc_name: tekton-logs
328+
secret_name: # optional
329+
gcs_creds_secret_name: <value>
330+
gcc_creds_secret_key: <value>
331+
gcs_bucket_name: <value>
332+
loki_stack_name: #optional
333+
loki_stack_namespace: #optional
334+
prometheus_port: 9090
335+
prometheus_histogram: false
336+
```
337+
287338
### Pruner
288339
Pruner provides auto clean up feature for the Tekton `pipelinerun` and `taskrun` resources. In the background pruner container runs `tkn` command.
289340

docs/TektonResult.md

Lines changed: 42 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,22 @@
1-
<!--
2-
---
1+
## <!--
2+
33
linkTitle: "TektonResult"
44
weight: 5
5+
56
---
7+
68
-->
9+
710
# Tekton Result
811

912
TektonResult custom resource allows user to install and manage [Tekton Result][result].
1013

11-
TektonResult is an optional component and currently cannot be installed through TektonConfig. It has to be installed seperately.
12-
13-
To install Tekton Result on your cluster follow steps as given below:
14-
- Make sure Tekton Pipelines is installed on your cluster, using the Operator.
15-
- Generate a database root password.
16-
A database root password must be generated and stored in a [Kubernetes Secret](https://kubernetes.io/docs/concepts/configuration/secret/)
17-
before installing results. By default, Tekton Results expects this secret to have
18-
the following properties:
19-
20-
- namespace: `tekton-pipelines`
21-
- name: `tekton-results-postgres`
22-
- contains the fields:
23-
- `user=<user name>`
24-
- `password=<your password>`
25-
26-
If you are not using a particular password management strategy, the following
27-
command will generate a random password for you:
28-
Update namespace value in the command if Tekton Pipelines is installed in a different namespace..
29-
30-
```sh
31-
export NAMESPACE="tekton-pipelines"
32-
kubectl create secret generic tekton-results-postgres --namespace=${NAMESPACE} --from-literal=POSTGRES_USER=result --from-literal=POSTGRES_PASSWORD=$(openssl rand -base64 20)
33-
```
34-
- Generate cert/key pair.
35-
Note: Feel free to use any cert management software to do this!
36-
37-
Tekton Results expects the cert/key pair to be stored in a [TLS Kubernetes Secret](https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets).
38-
Update the namespace value in below export command if Tekton Pipelines is installed in a different namespace.
39-
```sh
40-
export NAMESPACE="tekton-pipelines"
41-
# Generate new self-signed cert.
42-
openssl req -x509 \
43-
-newkey rsa:4096 \
44-
-keyout key.pem \
45-
-out cert.pem \
46-
-days 365 \
47-
-nodes \
48-
-subj "/CN=tekton-results-api-service.${NAMESPACE}.svc.cluster.local" \
49-
-addext "subjectAltName = DNS:tekton-results-api-service.${NAMESPACE}.svc.cluster.local"
50-
# Create new TLS Secret from cert.
51-
kubectl create secret tls -n ${NAMESPACE} tekton-results-tls \
52-
--cert=cert.pem \
53-
--key=key.pem
54-
```
55-
- Create PVC if using PVC for logging
14+
TektonResult is installed through [TektonConfig](./TektonConfig.md) by default.
15+
16+
**Note** : TektonOperator creates a secret for default database root password and a tls secret for TektonResult, the TektonResult doesn't rotate the tls certificate.
17+
18+
- Create PVC if using PVC for logging (Optional)
19+
5620
```!bash
5721
cat <<EOF > pvc.yaml
5822
apiVersion: v1
@@ -71,17 +35,15 @@ EOF
7135
kubectl apply -f pvc.yaml
7236
```
7337

74-
- Once the secrets are created create a TektonResult CR (Check ##Properties) as below.
75-
```sh
76-
kubectl apply -f config/crs/kubernetes/result/operator_v1alpha1_result_cr.yaml
77-
```
7838
- Check the status of installation using following command
7939
```sh
8040
kubectl get tektonresults.operator.tekton.dev
8141
```
8242

8343
## Spec
44+
8445
The TektonResult CR is like below:
46+
8547
```yaml
8648
apiVersion: operator.tekton.dev/v1alpha1
8749
kind: TektonResult
@@ -114,22 +76,23 @@ spec:
11476
11577
These properties are analogous to the one in configmap of tekton results api `tekton-results-api-config` documented at [api.md]:https://github.com/tektoncd/results/blob/4472848a0fb7c1473cfca8b647553170efac78a1/cmd/api/README.md
11678

117-
118-
[result]:https://github.com/tektoncd/results
119-
79+
[result]: https://github.com/tektoncd/results
12080

12181
### Property "secret_name":
82+
12283
`secret_name` - name of your custom secret or leave it as empty. It an optional property. The secret should be created by the user on the `targetNamespace`. The secret can contain `S3_` prefixed keys from the [result API properties](https://github.com/tektoncd/results/blob/fded140081468e418aeb860d16aca3306c675d8b/cmd/api/README.md). Please note: the key of the secret should be in UPPER_CASE and values should be in `string` format.
12384
The following keys are supported by this secret.
124-
* `S3_BUCKET_NAME`
125-
* `S3_ENDPOINT`
126-
* `S3_HOSTNAME_IMMUTABLE`
127-
* `S3_REGION`
128-
* `S3_ACCESS_KEY_ID`
129-
* `S3_SECRET_ACCESS_KEY`
130-
* `S3_MULTI_PART_SIZE`
85+
86+
- `S3_BUCKET_NAME`
87+
- `S3_ENDPOINT`
88+
- `S3_HOSTNAME_IMMUTABLE`
89+
- `S3_REGION`
90+
- `S3_ACCESS_KEY_ID`
91+
- `S3_SECRET_ACCESS_KEY`
92+
- `S3_MULTI_PART_SIZE`
13193

13294
#### Sample Secret File
95+
13396
```yaml
13497
apiVersion: v1
13598
kind: Secret
@@ -147,9 +110,10 @@ stringData:
147110
S3_MULTI_PART_SIZE: "5242880"
148111
```
149112

150-
151113
### GCS specific Property
114+
152115
The follow keys are needed for enabling GCS storage of logs:
116+
153117
```yaml
154118
apiVersion: operator.tekton.dev/v1alpha1
155119
kind: TektonResult
@@ -185,15 +149,18 @@ If you want to move from internal DB to external DB, please take backup of the D
185149
delete previous TektonResult CR. and recreate the fresh one with following instructions:
186150

187151
- Generate a secret with user name and password for Postgres (subsitute ${password} with your password):
152+
188153
```sh
189154
export NAMESPACE="tekton-pipelines" # Put the targetNamespace of TektonResult where it is going to be installed.
190155
kubectl create secret generic tekton-results-postgres --namespace=${NAMESPACE} --from-literal=POSTGRES_USER=result --from-literal=POSTGRES_PASSWORD=${password}
191156
```
192157

193158
- Create a TektonResult CR like below:
159+
194160
* Add `db_host` with DB url without port.
195161
* Add `db_port` with your DB port.
196162
* Set `is_external_db` to true.
163+
197164
```yaml
198165
apiVersion: operator.tekton.dev/v1alpha1
199166
kind: TektonResult
@@ -205,14 +172,12 @@ spec:
205172
db_user: result
206173
db_host: tekton-results-postgres-external-service.pg-redhat.svc.cluster.local
207174
is_external_db: true
208-
...
209175
```
210176

211177
### Securing the DB connection
212178

213179
To secure the DB connection using self-segned certificate or using certificate signed by 3rd party CA (e.g AWS RDS), one can provide path to the DB SSL root certificate, mounted and available on the Results API pod. The configuration will look like:
214180

215-
216181
```yaml
217182
apiVersion: operator.tekton.dev/v1alpha1
218183
kind: TektonResult
@@ -238,10 +203,11 @@ and bad for performance. It's better to use forwarders like Vector, Promtail, Fl
238203

239204
#### Loki
240205

241-
You can either use Grafana's [Helm Repo](https://grafana.com/docs/loki/latest/setup/install/helm/) or operator from [OperatorHub](https://operatorhub.io/operator/loki-operator) to install Loki.
206+
You can either use Grafana's [Helm Repo](https://grafana.com/docs/loki/latest/setup/install/helm/) or operator from [OperatorHub](https://operatorhub.io/operator/loki-operator) to install Loki.
242207
Installing via operator simplies certain operations for Tekton Operator. You just need to configure `lokistack_name` and `lokistack_namespace`.
243208

244209
In case of helm installation, you will need to configure options field to configure Results API configMap `tekton-results-api-config`:
210+
245211
```yaml
246212
LOGS_API
247213
LOGGING_PLUGIN_PROXY_PATH
@@ -260,6 +226,7 @@ Please consult the docs [here](https://github.com/tektoncd/results/blob/main/doc
260226
These fields allow you to configure how Tekton Results interacts with your Loki backend.
261227

262228
You might need to configure following environment variable to Tekton Results API deployment if you are using some custom CA to generate TLS certificate:
229+
263230
```yaml
264231
LOGGING_PLUGIN_CA_CERT
265232
```
@@ -270,14 +237,12 @@ LOGGING_PLUGIN_CA_CERT
270237

271238
You need to configure forwarder systems to add labels for namespace, pass TaskRun UID/PipelineRun UID in pods and a common label <key:value> alongwith logs from nodes.
272239

273-
A sample configuration for vector: [values.yaml](https://github.com/tektoncd/results/blob/main/test/e2e/loki_vector/vector.yaml).
240+
A sample configuration for vector: [values.yaml](https://github.com/tektoncd/results/blob/main/test/e2e/loki_vector/vector.yaml).
274241

275242
### OpenShift (LokiStack + OpenShift Logging)
276243

277-
278244
To configure LokiStack with TektonResult, you can use the `lokistack_name` and `lokistack_namespace` properties in the TektonResult custom resource. Here's how to do it:
279245

280-
281246
1. First, ensure that you have LokiStack installed in your cluster.
282247

283248
2. Then, create or update your TektonResult CR with the following properties:
@@ -293,16 +258,17 @@ spec:
293258
lokistack_name: your-lokistack-name
294259
lokistack_namespace: your-lokistack-namespace
295260
```
261+
296262
Replace your-lokistack-name with the name of your LokiStack instance and your-lokistack-namespace with the namespace where LokiStack is installed.
297263

298264
By setting these properties, Operator will configure Tekton Result to use the specified LokiStack instance for log retrieval.
299265

300-
301266
#### OpenShift Logging
302267

303268
Install the openshift logging operator by following this: [Deploying Cluster Logging](https://docs.openshift.com/container-platform/4.16/observability/logging/cluster-logging-deploying.html#logging-loki-gui-install_cluster-logging-deploying)
304269

305270
If you are installing OpenShift Logging Operator only for TaskRun Logs, then you also need to configure a ClusterLogForwarder:
271+
306272
```yaml
307273
apiVersion: "logging.openshift.io/v1"
308274
kind: ClusterLogForwarder
@@ -311,15 +277,15 @@ metadata:
311277
namespace: openshift-logging
312278
spec:
313279
inputs:
314-
- name: only-tekton
315-
application:
316-
selector:
317-
matchLabels:
318-
app.kubernetes.io/managed-by: tekton-pipelines
280+
- name: only-tekton
281+
application:
282+
selector:
283+
matchLabels:
284+
app.kubernetes.io/managed-by: tekton-pipelines
319285
pipelines:
320286
- name: enable-default-log-store
321-
inputRefs: [ only-tekton ]
322-
outputRefs: [ default ]
287+
inputRefs: [only-tekton]
288+
outputRefs: [default]
323289
```
324290

325291
### Debugging

0 commit comments

Comments
 (0)