Skip to content

Commit faf5933

Browse files
argo-cd-cherry-pick-bot[bot]shuangkunJoibel
authored
perf: set ResourceVersion=0 in deleteTaskResults to reduce etcd pressure. (cherry-pick #15115 for 3.7) (#15151)
Signed-off-by: shuangkun <[email protected]> Co-authored-by: shuangkun tian <[email protected]> Co-authored-by: Alan Clucas <[email protected]>
1 parent 9572e7b commit faf5933

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

workflow/controller/operator.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,13 @@ func (woc *wfOperationCtx) deleteTaskResults(ctx context.Context) error {
834834
DeleteCollection(
835835
ctx,
836836
metav1.DeleteOptions{PropagationPolicy: &deletePropagationBackground},
837-
metav1.ListOptions{LabelSelector: common.LabelKeyWorkflow + "=" + woc.wf.Name},
837+
metav1.ListOptions{
838+
LabelSelector: common.LabelKeyWorkflow + "=" + woc.wf.Name,
839+
// DeleteCollection does a "list" operation to get the resources to delete, which by default does a strongly consistent read of the most recent version.
840+
// This can be slow for Kubernetes versions before 1.34, so we set resourceVersion=0 to relax consistency and tell the k8s API to return any resource version.
841+
// It's possible for this to miss some resources, but those should be GC'd when the parent workflow is deleted.
842+
ResourceVersion: "0",
843+
},
838844
)
839845
}
840846

0 commit comments

Comments
 (0)