github.com/argoproj/argo-cd/v3@v3.2.1/util/notification/k8s/informers.go (about) 1 package k8s 2 3 import ( 4 "time" 5 6 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 7 informersv1 "k8s.io/client-go/informers/core/v1" 8 "k8s.io/client-go/kubernetes" 9 "k8s.io/client-go/tools/cache" 10 ) 11 12 const ( 13 settingsResyncDuration = 3 * time.Minute 14 ) 15 16 func NewSecretInformer(clientset kubernetes.Interface, namespace string, secretName string) cache.SharedIndexInformer { 17 return informersv1.NewFilteredSecretInformer(clientset, namespace, settingsResyncDuration, cache.Indexers{}, func(options *metav1.ListOptions) { 18 options.FieldSelector = "metadata.name=" + secretName 19 }) 20 } 21 22 func NewConfigMapInformer(clientset kubernetes.Interface, namespace string, configMapName string) cache.SharedIndexInformer { 23 return informersv1.NewFilteredConfigMapInformer(clientset, namespace, settingsResyncDuration, cache.Indexers{}, func(options *metav1.ListOptions) { 24 options.FieldSelector = "metadata.name=" + configMapName 25 }) 26 }