diff --git a/workflow/controller/controller.go b/workflow/controller/controller.go index 5bf5d5dadc86..aee6b0599185 100644 --- a/workflow/controller/controller.go +++ b/workflow/controller/controller.go @@ -851,7 +851,10 @@ func (wfc *WorkflowController) tweakListRequestListOptions(options *metav1.ListO options.LabelSelector = labelSelector.String() // `ResourceVersion=0` does not honor the `limit` in API calls, which results in making significant List calls // without `limit`. For details, see https://github.com/argoproj/argo-workflows/pull/11343 - options.ResourceVersion = "" + // Check if ResourceVersion is "0" and reset it to empty string to ensure proper pagination behavior + if options.ResourceVersion == "0" { + options.ResourceVersion = "" + } } func (wfc *WorkflowController) tweakWatchRequestListOptions(options *metav1.ListOptions) { diff --git a/workflow/controller/informer/tolerant_cluster_workflow_template_informer.go b/workflow/controller/informer/tolerant_cluster_workflow_template_informer.go index b603f0cfeec9..92e9c0f9deef 100644 --- a/workflow/controller/informer/tolerant_cluster_workflow_template_informer.go +++ b/workflow/controller/informer/tolerant_cluster_workflow_template_informer.go @@ -24,7 +24,10 @@ func NewTolerantClusterWorkflowTemplateInformer(dynamicInterface dynamic.Interfa return &tolerantClusterWorkflowTemplateInformer{delegate: dynamicinformer.NewFilteredDynamicSharedInformerFactory(dynamicInterface, defaultResync, "", func(options *metav1.ListOptions) { // `ResourceVersion=0` does not honor the `limit` in API calls, which results in making significant List calls // without `limit`. For details, see https://github.com/argoproj/argo-workflows/pull/11343 - options.ResourceVersion = "" + // Check if ResourceVersion is "0" and reset it to empty string to ensure proper pagination behavior + if options.ResourceVersion == "0" { + options.ResourceVersion = "" + } }).ForResource(schema.GroupVersionResource{Group: workflow.Group, Version: workflow.Version, Resource: workflow.ClusterWorkflowTemplatePlural})} } diff --git a/workflow/controller/informer/tolerant_workflow_template_informer.go b/workflow/controller/informer/tolerant_workflow_template_informer.go index 21c89636dfe5..eb7b37ce677d 100644 --- a/workflow/controller/informer/tolerant_workflow_template_informer.go +++ b/workflow/controller/informer/tolerant_workflow_template_informer.go @@ -24,7 +24,10 @@ func NewTolerantWorkflowTemplateInformer(dynamicInterface dynamic.Interface, def return &tolerantWorkflowTemplateInformer{delegate: dynamicinformer.NewFilteredDynamicSharedInformerFactory(dynamicInterface, defaultResync, namespace, func(options *metav1.ListOptions) { // `ResourceVersion=0` does not honor the `limit` in API calls, which results in making significant List calls // without `limit`. For details, see https://github.com/argoproj/argo-workflows/pull/11343 - options.ResourceVersion = "" + // Check if ResourceVersion is "0" and reset it to empty string to ensure proper pagination behavior + if options.ResourceVersion == "0" { + options.ResourceVersion = "" + } }).ForResource(schema.GroupVersionResource{Group: workflow.Group, Version: workflow.Version, Resource: workflow.WorkflowTemplatePlural})} } diff --git a/workflow/controller/taskresult.go b/workflow/controller/taskresult.go index 971c7b7d7692..a66d47b0a532 100644 --- a/workflow/controller/taskresult.go +++ b/workflow/controller/taskresult.go @@ -45,7 +45,10 @@ func (wfc *WorkflowController) newWorkflowTaskResultInformer(ctx context.Context options.LabelSelector = labelSelector // `ResourceVersion=0` does not honor the `limit` in API calls, which results in making significant List calls // without `limit`. For details, see https://github.com/argoproj/argo-workflows/pull/11343 - options.ResourceVersion = "" + // Check if ResourceVersion is "0" and reset it to empty string to avoid missing watch event. + if options.ResourceVersion == "0" { + options.ResourceVersion = "" + } }, ) //nolint:errcheck // the error only happens if the informer was stopped, and it hasn't even started (https://github.com/kubernetes/client-go/blob/46588f2726fa3e25b1704d6418190f424f95a990/tools/cache/shared_informer.go#L580)