1
1
---
2
- status : proposed
2
+ status : implementable
3
3
title : Changing the way result parameters are stored
4
4
creation-date : ' 2021-09-27'
5
- last-updated : ' 2022-06-09 '
5
+ last-updated : ' 2022-06-28 '
6
6
authors :
7
7
- ' @tlawrie'
8
8
- ' @imjasonh'
9
9
- ' @bobcatfish'
10
10
- ' @pritidesai'
11
11
- ' @tomcli'
12
12
- ' @ScrapCodes'
13
+ - ' @chitrangpatel'
14
+ - ' @jerop'
13
15
---
14
16
15
17
# TEP-0086: Changing the way result parameters are stored
@@ -21,7 +23,11 @@ authors:
21
23
- [ Non-Goals] ( #non-goals )
22
24
- [ Use Cases (optional)] ( #use-cases-optional )
23
25
- [ 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 )
25
31
- [ Alternatives] ( #alternatives )
26
32
- [ Result Sidecar - Upload results from sidecar] ( #result-sidecar---upload-results-from-sidecar )
27
33
- [ Option: Supporting multiple sidecars] ( #option-supporting-multiple-sidecars )
@@ -44,7 +50,6 @@ authors:
44
50
- [ Store results on PVCs] ( #store-results-on-pvcs )
45
51
- [ No change. Use workspaces.] ( #no-change-use-workspaces )
46
52
- [ Repurpose Artifact Storage API] ( #repurpose-artifact-storage-api )
47
- - [ Using logs emitted by the Task] ( #using-logs-emitted-by-the-task )
48
53
- [ Infrastructure Needed (optional)] ( #infrastructure-needed-optional )
49
54
- [ Upgrade & ; Migration Strategy (optional)] ( #upgrade--migration-strategy-optional )
50
55
- [ Implementation Pull request(s)] ( #implementation-pull-requests )
@@ -115,6 +120,55 @@ Additionally, this will help projects that wrap/abstract Tekton where users unde
115
120
* Define a clear upper limit on the expected maximum size of a result.
116
121
* Support an environment where executing pods are not permitted to make network connections within the cluster.
117
122
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
+
118
172
## Alternatives
119
173
120
174
### Result Sidecar - Upload results from sidecar
@@ -374,22 +428,6 @@ Cons:
374
428
- [Docs on setting up storage](https://github.com/tektoncd/pipeline/blob/main/docs/install.md#configuring-pipelineresource-storage)
375
429
- [Interface](https://github.com/tektoncd/pipeline/blob/main/pkg/artifacts/artifacts_storage.go#L39-L47)
376
430
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
-
393
431
# ## Using embedded storage client to store result files in remote storage
394
432
395
433
- 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.
452
490
- [HackMD Result Collector Sidecar Design](https://hackmd.io/a6Kl4oS0SaOyBqBPTirzaQ)
453
491
- [TEP-0086 Design Breakout Session Recording](https://drive.google.com/file/d/1lIqyy1RyZMYOrMCC2CLZD8eOf0NrVeDb/view?usp=sharing)
454
492
- [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
0 commit comments