You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change the ytt fields to accept arrays as well as single entries, such that you can append an overlay or other modifications to the ytt steps without modifying the previous ones.
#1119
Currently whenever you see a ytt field in a spec if you want to modify it you're stuck doing ytt overlays to embedded ytt, which is very difficult in Carvel.
Here are examples of all 4 in the same file even, each more gruesome and painful as we go on!
If you are fortunate enough that you can just stick what you need at the end of the spec (because yaml!) then just go ahead and slap it at the end: Just adding to the end
If you need to change something in the middle, you can do a find and replace: Surgical find/replace
If you are making massive changes just copy and paste the whole thing, making the changes you need and then rigorously and continuously validating it every time there's a change: Just replace the whole thing manually
(this is probably the worst one)
I want this to be my favorite, and I feel like it's the most inventive, but unfortunately this one is just as hard to maintain as the others, but append an overlay that modifies the other ytt preceding it: Append an overlay of ytt to the end
Proposed solution
As mentioned in approach 4, if ytt instead took an array (or map?) of things instead of a single entry then case 4 could be approached by appending the overlay to the ytt entries instead of sticking it to the end of the string. Or instead of modifying the ytt field offer another way to easily add overlays -- another field, or similar.
Given the ytt field accepts an array (or there is a new overlays field or additional_ytt or similar)
When I need to add an overlay to an existing entry
Then I can just add that ytt as another entry to the fields
Example
Basically take the example listed under 4 and change it to be an append to an array instead of appending to a string.
Adding context from some conversations today. Considering this approach:
Cartographer templates gain a new field named along the lines of .spec.additional_ytt_files. This field contains a list of selectors and namespaces of configMaps. Any such configMap found would be expected to contain an additional file to pass to ytt (e.g. ytt -f some-file.yaml -f some-additional-file.yaml)
This is a rough sketch, syntax can change:
---
kind: ClusterSourceTemplatemetadata:
name: testing-pipelinespec:
ytt:
some_template_defadditional_ytt_files:
- namespace: tap-installselector:
match_labels:
- tap
- testing-pipeline
---
kind: ConfigMapmetadata:
name: some-new-overlaynamespace: tap-installlabels:
- tap
- testing-pipelinedata:
Some ytt
Description of problem
Currently whenever you see a ytt field in a spec if you want to modify it you're stuck doing ytt overlays to embedded ytt, which is very difficult in Carvel.
Here are examples of all 4 in the same file even, each more gruesome and painful as we go on!
Just adding to the end
Surgical find/replace
Just replace the whole thing manually
(this is probably the worst one)
Append an overlay of ytt to the end
Proposed solution
As mentioned in approach 4, if
ytt
instead took an array (or map?) of things instead of a single entry then case 4 could be approached by appending the overlay to the ytt entries instead of sticking it to the end of the string. Or instead of modifying theytt
field offer another way to easily add overlays -- another field, or similar.Example
Basically take the example listed under 4 and change it to be an append to an array instead of appending to a string.
Additional Context
The text was updated successfully, but these errors were encountered: