feat(watcher): add --required_annotations to hold the finalizer until extra keys are true - #1471
feat(watcher): add --required_annotations to hold the finalizer until extra keys are true#1471ankrsinha wants to merge 1 commit into
Conversation
… extra keys are true The watcher currently clears its finalizer as soon as results.tekton.dev/stored is true. In multicluster setups, external controllers may still need to annotate the PipelineRun or TaskRun, and those writes are lost if the object is deleted first. Add --required_annotations, a comma-separated list of extra keys that must all be set to true before the finalizer is cleared. The stored annotation stays implicitly required and does not need to be listed. When the flag is empty, behavior is unchanged. store_deadline still clears the finalizer so objects cannot remain stuck. Signed-off-by: Ankur Sinha <anksinha@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
enarha
left a comment
There was a problem hiding this comment.
IMO the expectation that the value of annotation is always "true" (or "false") is optimistic and limits the design and would require breaking changes to extend. By definition, the value of annotation is a arbitrary string, so assume someone wants to filter on "color": "green" or "ci": "passed". This complicates the design because you can't properly parse the flag value if provided as a string as the annotation value can really include any char, including =, ,, :. One option is to ask the user to pass the --required_annotations flag multiple times e.g. --required_annotation "color:green" --required_annotation "ci:passed". This could work unambiguously because there are certain limitations on the annotation key, so you can split on the first : or first =, consider that the key and the rest of the string as the value. This is from the top of my head and it should be properly evaluated and other options can exist as well.
Another thing to consider is that today we decided to apply that filter to PipelineRun and TaskRun and exclude CustomRun. I understand why it's done now this way, but that's not really generic. We are planning to extend support in Tekton Results for arbitrary Kubernetes objects and I can imagine users asking for that feature for any type of stored object. I do not want to complicate the design too much, but if we can also achieve that from the start e.g. map a list of resources to a list of annotations, that would be better. We can go with the current design, but switching to new configuration design becomes harder later.
@enarha Agreed on this. we can switch to a repeatable --required_annotation flag with key:value parsing. If no separator is given, the value defaults to "true", so the common case (checking for a boolean annotation) stays simple. Ex- Implementation-wise, Go's wdyt @khrm ? Shall i go ahead and make changes for this ? |
Personally I'm not a huge fan of the implicit value The other thing if which character to designate as separator, |
Quick search shows that |
Changes
The watcher currently clears its finalizer as soon as
results.tekton.dev/storedistrue. In multicluster setups,external controllers may still need to annotate the PipelineRun or
TaskRun, and those writes are lost if the object is deleted first.
This PR adds a
--required_annotationsflag: a comma-separated list ofextra annotation keys that must all be set to
"true"before thefinalizer is cleared.
results.tekton.dev/storedstays required and does not need to be listed"true"store_deadlinestill clears the finalizer so objects cannot stay stuck/kind feature
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you review them:
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes