Skip to content

Commit 7a4c43a

Browse files
committed
TEP-0086: Larger Results via Sidecar Logs
In this change, we propose moving forward with Sidecar Logs as the solution for providing larger Results within the CRDs. /kind tep
1 parent c286836 commit 7a4c43a

File tree

2 files changed

+64
-21
lines changed

2 files changed

+64
-21
lines changed

teps/0086-changing-the-way-result-parameters-are-stored.md

+63-20
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
---
2-
status: proposed
2+
status: implementable
33
title: Changing the way result parameters are stored
44
creation-date: '2021-09-27'
5-
last-updated: '2022-06-09'
5+
last-updated: '2022-06-28'
66
authors:
77
- '@tlawrie'
88
- '@imjasonh'
99
- '@bobcatfish'
1010
- '@pritidesai'
1111
- '@tomcli'
1212
- '@ScrapCodes'
13+
- '@chitrangpatel'
14+
- '@jerop'
1315
---
1416

1517
# TEP-0086: Changing the way result parameters are stored
@@ -21,7 +23,11 @@ authors:
2123
- [Non-Goals](#non-goals)
2224
- [Use Cases (optional)](#use-cases-optional)
2325
- [Requirements](#requirements)
24-
- [Required](#required)
26+
- [Proposal](#proposal)
27+
- [Larger Results via Sidecar Logs](#larger-results-via-sidecar-logs)
28+
- [Feature Gates for Sidecar Logs](#feature-gates-for-sidecar-logs)
29+
- [Design Details of Sidecar Logs](#design-details-of-sidecar-logs)
30+
- [Caveats of Sidecar Logs](#caveats-of-sidecar-logs)
2531
- [Alternatives](#alternatives)
2632
- [Result Sidecar - Upload results from sidecar](#result-sidecar---upload-results-from-sidecar)
2733
- [Option: Supporting multiple sidecars](#option-supporting-multiple-sidecars)
@@ -44,7 +50,6 @@ authors:
4450
- [Store results on PVCs](#store-results-on-pvcs)
4551
- [No change. Use workspaces.](#no-change-use-workspaces)
4652
- [Repurpose Artifact Storage API](#repurpose-artifact-storage-api)
47-
- [Using logs emitted by the Task](#using-logs-emitted-by-the-task)
4853
- [Infrastructure Needed (optional)](#infrastructure-needed-optional)
4954
- [Upgrade & Migration Strategy (optional)](#upgrade--migration-strategy-optional)
5055
- [Implementation Pull request(s)](#implementation-pull-requests)
@@ -115,6 +120,55 @@ Additionally, this will help projects that wrap/abstract Tekton where users unde
115120
* Define a clear upper limit on the expected maximum size of a result.
116121
* Support an environment where executing pods are not permitted to make network connections within the cluster.
117122

123+
## Proposal
124+
125+
There's no solution that will meet all the [requirements](#requirements) described above. We propose that we provide
126+
multiple solutions, which users can choose to address their needs.
127+
128+
### Larger Results via Sidecar Logs
129+
130+
We propose using **stdout logs from a dedicated `Sidecar` to return a json `Result` object** to support larger
131+
`Results`. The controller would wait for the `Sidecar` to exit and then read the logs based on a particular query and
132+
append info to the `TaskRun`.
133+
134+
We propose injecting a dedicated `Sidecar` alongside the `Steps` which will watch the `Results` path of the `Steps`.
135+
This `Sidecar` will output the name of the `Result` and its contents to stdout in a parsable pattern. The `TaskRun`
136+
controller will access the stdout logs of the `Sidecar`, extract the `Result` and its contents during reconciliation.
137+
After the `Steps` have terminated, the `TaskRun` controller will attach the `Results` from the logs of the `Sidecar`
138+
instead of using the termination message (hence bypassing the 4K limit) to update the `Results` fields in the CRD.
139+
This method keeps the rest of the current functionality identical and does not require any external storage mechanism.
140+
For further details, see the [demonstration][demo] of the proof of concept.
141+
142+
#### Feature Gates for Sidecar Logs
143+
144+
This solution will be gated using a `enable-sidecar-logs-results` feature flag which will default to `"false"` and
145+
users can set it to `"true"` to enable it. This provides an opportunity to experiment with this solution to provide
146+
`Results` within the CRDs as we figure out the solutions for external storage.
147+
148+
In [TEP-0100][tep-0100] we proposed changes to `PipelineRun` status to reduce the amount of information stored about
149+
the status of `TaskRuns` and `Runs` to improve performance, reduce memory bloat and improve extensibility. Now that
150+
those changes have been implemented, the `PipelineRun` status is set up to handle larger `Results` without
151+
exacerbating the performance and storage issues that were there before. For `ChildReferences` to be populated, the
152+
`embedded-status` must be set to `"minimal"`. Thus, will require that minimal embedded status is enabled during the
153+
migration until it becomes the only supported status. This requirement also makes the behavior clearer to users -
154+
auto-adding the minimal status when users have not enabled it makes the user experience opaque and surprising.
155+
156+
#### Design Details of Sidecar Logs
157+
158+
In order to parse the `Results` volume and output the contents to stdout in the `Container`, the `Sidecar` will run
159+
a script that:
160+
- is auto-generated based on the required `Results` - identified from `taskSpec.results` field.
161+
- periodically checks for files in the directory `/tekton/results`.
162+
- when a `Result` is found, it prints it to stdout in a parsable pattern.
163+
- When all the expected `Results` are found, it breaks out of the periodic loop and exits.
164+
165+
#### Caveats of Sidecar Logs
166+
167+
- If a `Step` fails to produce a `Result`, the `Sidecar` will continue to look for the `Result` until it times out.
168+
This is a broader issue in `Results`, as discussed in [tektoncd/pipeline#3497][tektoncd/pipeline#3497].
169+
- The storage of the result parameter may still be limited by the maximum allowed [CRD size][crd-size]. Note that the
170+
maximum size is shared among all the `Results` of the `TaskRun` and all its other contents (e.g. `Status`).
171+
118172
## Alternatives
119173

120174
### Result Sidecar - Upload results from sidecar
@@ -374,22 +428,6 @@ Cons:
374428
- [Docs on setting up storage](https://github.com/tektoncd/pipeline/blob/main/docs/install.md#configuring-pipelineresource-storage)
375429
- [Interface](https://github.com/tektoncd/pipeline/blob/main/pkg/artifacts/artifacts_storage.go#L39-L47)
376430

377-
### Using logs emitted by the Task
378-
379-
- We are also exploring using **stdout logs from a dedicated sidecar to return a json result object** as a simpler way
380-
to support larger TaskResults, but we need to explore this in a POC as we suspect we may not be able to rely on logs for this.
381-
- The controller would wait for the sidecar to exit and then read the logs based on a particular query and append info to the TaskRun
382-
- Potential to use a CloudEvent object to wrap result object
383-
384-
Cons:
385-
- No guarantees on when logs will be available (would have to wait for this before considering a TaskRun complete)
386-
- No guarantee you'll be able to access a log before it disappears (e.g. logs will not be available via the k8s API
387-
once a pod is deleted)
388-
- The storage of the result parameter may still be limited by a number of scenarios, including:
389-
- [1.5 MB CRD size](https://github.com/kubernetes/kubernetes/issues/82292)
390-
- The total size of the PipelineRun _if_ the TaskRun content is included, however
391-
[TEP-100 is removing this](https://github.com/tektoncd/community/blob/main/teps/0100-embedded-taskruns-and-runs-status-in-pipelineruns.md)
392-
393431
### Using embedded storage client to store result files in remote storage
394432

395433
- Use embedded storage client to store results. It needs an extra post-processing step since some storage client may have some dependency on the container
@@ -452,3 +490,8 @@ It will be a quick reference for those looking for implementation of this TEP.
452490
- [HackMD Result Collector Sidecar Design](https://hackmd.io/a6Kl4oS0SaOyBqBPTirzaQ)
453491
- [TEP-0086 Design Breakout Session Recording](https://drive.google.com/file/d/1lIqyy1RyZMYOrMCC2CLZD8eOf0NrVeDb/view?usp=sharing)
454492
- [TEP-0086 Design Breakout Session Notes](https://hackmd.io/YU_g27vRS2S5DwfBXDGpYA?view)
493+
494+
[crd-size]: https://github.com/kubernetes/kubernetes/issues/82292
495+
[tep-0100]: ./0100-embedded-taskruns-and-runs-status-in-pipelineruns.md
496+
[demo]: https://drive.google.com/file/d/14tDHNgpzOZ--5nMsOsTBhxsDgDDM_7iQ/view?t=1h01m41s
497+
[tektoncd/pipeline#3497]: https://github.com/tektoncd/pipeline/issues/3497

teps/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ This is the complete list of Tekton teps:
238238
|[TEP-0083](0083-scheduled-and-polling-runs-in-tekton.md) | Scheduled and Polling runs in Tekton | proposed | 2021-09-13 |
239239
|[TEP-0084](0084-endtoend-provenance-collection.md) | end-to-end provenance collection | proposed | 2021-09-16 |
240240
|[TEP-0085](0085-per-namespace-controller-configuration.md) | Per-Namespace Controller Configuration | proposed | 2021-10-14 |
241-
|[TEP-0086](0086-changing-the-way-result-parameters-are-stored.md) | Changing the way result parameters are stored | proposed | 2022-06-09 |
241+
|[TEP-0086](0086-changing-the-way-result-parameters-are-stored.md) | Changing the way result parameters are stored | implementable | 2022-06-28 |
242242
|[TEP-0088](0088-result-summaries.md) | Tekton Results - Record Summaries | proposed | 2021-10-01 |
243243
|[TEP-0089](0089-nonfalsifiable-provenance-support.md) | Non-falsifiable provenance support | implementable | 2022-01-18 |
244244
|[TEP-0090](0090-matrix.md) | Matrix | implementable | 2022-06-22 |

0 commit comments

Comments
 (0)