-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
tolerant_workflow_template_informer.go
34 lines (27 loc) · 1.42 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
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) {}).
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()}
}