github.com/cilium/cilium@v1.16.2/pkg/k8s/client/informers/externalversions/cilium.io/v2/ciliumenvoyconfig.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  // Code generated by informer-gen. DO NOT EDIT.
     5  
     6  package v2
     7  
     8  import (
     9  	"context"
    10  	time "time"
    11  
    12  	ciliumiov2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2"
    13  	versioned "github.com/cilium/cilium/pkg/k8s/client/clientset/versioned"
    14  	internalinterfaces "github.com/cilium/cilium/pkg/k8s/client/informers/externalversions/internalinterfaces"
    15  	v2 "github.com/cilium/cilium/pkg/k8s/client/listers/cilium.io/v2"
    16  	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    17  	runtime "k8s.io/apimachinery/pkg/runtime"
    18  	watch "k8s.io/apimachinery/pkg/watch"
    19  	cache "k8s.io/client-go/tools/cache"
    20  )
    21  
    22  // CiliumEnvoyConfigInformer provides access to a shared informer and lister for
    23  // CiliumEnvoyConfigs.
    24  type CiliumEnvoyConfigInformer interface {
    25  	Informer() cache.SharedIndexInformer
    26  	Lister() v2.CiliumEnvoyConfigLister
    27  }
    28  
    29  type ciliumEnvoyConfigInformer struct {
    30  	factory          internalinterfaces.SharedInformerFactory
    31  	tweakListOptions internalinterfaces.TweakListOptionsFunc
    32  	namespace        string
    33  }
    34  
    35  // NewCiliumEnvoyConfigInformer constructs a new informer for CiliumEnvoyConfig type.
    36  // Always prefer using an informer factory to get a shared informer instead of getting an independent
    37  // one. This reduces memory footprint and number of connections to the server.
    38  func NewCiliumEnvoyConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
    39  	return NewFilteredCiliumEnvoyConfigInformer(client, namespace, resyncPeriod, indexers, nil)
    40  }
    41  
    42  // NewFilteredCiliumEnvoyConfigInformer constructs a new informer for CiliumEnvoyConfig type.
    43  // Always prefer using an informer factory to get a shared informer instead of getting an independent
    44  // one. This reduces memory footprint and number of connections to the server.
    45  func NewFilteredCiliumEnvoyConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
    46  	return cache.NewSharedIndexInformer(
    47  		&cache.ListWatch{
    48  			ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
    49  				if tweakListOptions != nil {
    50  					tweakListOptions(&options)
    51  				}
    52  				return client.CiliumV2().CiliumEnvoyConfigs(namespace).List(context.TODO(), options)
    53  			},
    54  			WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
    55  				if tweakListOptions != nil {
    56  					tweakListOptions(&options)
    57  				}
    58  				return client.CiliumV2().CiliumEnvoyConfigs(namespace).Watch(context.TODO(), options)
    59  			},
    60  		},
    61  		&ciliumiov2.CiliumEnvoyConfig{},
    62  		resyncPeriod,
    63  		indexers,
    64  	)
    65  }
    66  
    67  func (f *ciliumEnvoyConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
    68  	return NewFilteredCiliumEnvoyConfigInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
    69  }
    70  
    71  func (f *ciliumEnvoyConfigInformer) Informer() cache.SharedIndexInformer {
    72  	return f.factory.InformerFor(&ciliumiov2.CiliumEnvoyConfig{}, f.defaultInformer)
    73  }
    74  
    75  func (f *ciliumEnvoyConfigInformer) Lister() v2.CiliumEnvoyConfigLister {
    76  	return v2.NewCiliumEnvoyConfigLister(f.Informer().GetIndexer())
    77  }