-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
tolerant_workflow_template_informer.go
37 lines (30 loc) · 1.65 KB
/
tolerant_workflow_template_informer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package informer
import (
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/dynamic/dynamicinformer"
"k8s.io/client-go/informers"
"k8s.io/client-go/tools/cache"
"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow"
extwfv1 "github.com/argoproj/argo-workflows/v3/pkg/client/informers/externalversions/workflow/v1alpha1"
"github.com/argoproj/argo-workflows/v3/pkg/client/listers/workflow/v1alpha1"
)
type tolerantWorkflowTemplateInformer struct {
delegate informers.GenericInformer
}
// a drop-in replacement for `extwfv1.WorkflowTemplateInformer` that ignores malformed resources
func NewTolerantWorkflowTemplateInformer(dynamicInterface dynamic.Interface, defaultResync time.Duration, namespace string) extwfv1.WorkflowTemplateInformer {
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 = ""
}).ForResource(schema.GroupVersionResource{Group: workflow.Group, Version: workflow.Version, Resource: workflow.WorkflowTemplatePlural})}
}
func (t *tolerantWorkflowTemplateInformer) Informer() cache.SharedIndexInformer {
return t.delegate.Informer()
}
func (t *tolerantWorkflowTemplateInformer) Lister() v1alpha1.WorkflowTemplateLister {
return &tolerantWorkflowTemplateLister{delegate: t.delegate.Lister()}
}