informers

package
v1.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultKubeEventResyncInterval is the default resync interval for k8s events
	// This is set to 0 because we do not need resyncs from k8s client, and have our
	// own Ticker to turn on periodic resyncs.
	DefaultKubeEventResyncInterval = 0 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type InformerCollection

type InformerCollection struct {
	// contains filtered or unexported fields
}

InformerCollection is an abstraction around a set of informers initialized with the clients stored in its fields. This data type should only be passed around as a pointer

func NewInformerCollection

func NewInformerCollection(meshName string, stop <-chan struct{}, opts ...InformerCollectionOption) (*InformerCollection, error)

NewInformerCollection creates a new InformerCollection

func (*InformerCollection) Add

func (ic *InformerCollection) Add(key InformerKey, obj interface{}, t *testing.T) error

Add is only exported for the sake of tests and requires a testing.T to ensure it's never used in production. This functionality was added for the express purpose of testing flexibility since alternatives can often lead to flaky tests and race conditions between the time an object is added to a fake clientset and when that object is actually added to the informer `cache.Store`

func (*InformerCollection) AddEventHandler

func (ic *InformerCollection) AddEventHandler(informerKey InformerKey, handler cache.ResourceEventHandler)

AddEventHandler adds an handler to the informer indexed by the given InformerKey

func (*InformerCollection) GetByKey

func (ic *InformerCollection) GetByKey(informerKey InformerKey, objectKey string) (interface{}, bool, error)

GetByKey retrieves an item (based on the given index) from the store of the informer indexed by the given InformerKey

func (InformerCollection) IsMonitoredNamespace

func (ic InformerCollection) IsMonitoredNamespace(namespace string) bool

IsMonitoredNamespace returns a boolean indicating if the namespace is among the list of monitored namespaces

func (*InformerCollection) List

func (ic *InformerCollection) List(informerKey InformerKey) []interface{}

List returns the contents of the store of the informer indexed by the given InformerKey

func (*InformerCollection) Update

func (ic *InformerCollection) Update(key InformerKey, obj interface{}, t *testing.T) error

Update is only exported for the sake of tests and requires a testing.T to ensure it's never used in production. This functionality was added for the express purpose of testing flexibility since the alternatives can often lead to flaky tests and race conditions between the time an object is added to a fake clientset and when that object is actually added to the informer `cache.Store`

type InformerCollectionOption

type InformerCollectionOption func(*InformerCollection)

InformerCollectionOption is a function that modifies an informer collection

func WithConfigClient

func WithConfigClient(configClient configClientset.Interface, meshConfigName, osmNamespace string) InformerCollectionOption

WithConfigClient sets the config client for the InformerCollection

func WithKubeClient

func WithKubeClient(kubeClient kubernetes.Interface) InformerCollectionOption

WithKubeClient sets the kubeClient for the InformerCollection

func WithPolicyClient

func WithPolicyClient(policyClient policyClientset.Interface) InformerCollectionOption

WithPolicyClient sets the policy client for the InformerCollection

func WithSMIClients

func WithSMIClients(smiTrafficSplitClient smiTrafficSplitClient.Interface, smiTrafficSpecClient smiTrafficSpecClient.Interface, smiAccessClient smiTrafficAccessClient.Interface) InformerCollectionOption

WithSMIClients sets the SMI clients for the InformerCollection

type InformerKey

type InformerKey string

InformerKey stores the different Informers we keep for K8s resources

const (
	// InformerKeyNamespace is the InformerKey for a Namespace informer
	InformerKeyNamespace InformerKey = "Namespace"
	// InformerKeyService is the InformerKey for a Service informer
	InformerKeyService InformerKey = "Service"
	// InformerKeyPod is the InformerKey for a Pod informer
	InformerKeyPod InformerKey = "Pod"
	// InformerKeyEndpoints is the InformerKey for a Endpoints informer
	InformerKeyEndpoints InformerKey = "Endpoints"
	// InformerKeyServiceAccount is the InformerKey for a ServiceAccount informer
	InformerKeyServiceAccount InformerKey = "ServiceAccount"

	// InformerKeyTrafficSplit is the InformerKey for a TrafficSplit informer
	InformerKeyTrafficSplit InformerKey = "TrafficSplit"
	// InformerKeyTrafficTarget is the InformerKey for a TrafficTarget informer
	InformerKeyTrafficTarget InformerKey = "TrafficTarget"
	// InformerKeyHTTPRouteGroup is the InformerKey for a HTTPRouteGroup informer
	InformerKeyHTTPRouteGroup InformerKey = "HTTPRouteGroup"
	// InformerKeyTCPRoute is the InformerKey for a TCPRoute informer
	InformerKeyTCPRoute InformerKey = "TCPRoute"

	// InformerKeyMeshConfig is the InformerKey for a MeshConfig informer
	InformerKeyMeshConfig InformerKey = "MeshConfig"
	// InformerKeyMeshRootCertificate is the InformerKey for a MeshRootCertificate informer
	InformerKeyMeshRootCertificate InformerKey = "MeshRootCertificate"

	// InformerKeyEgress is the InformerKey for a Egress informer
	InformerKeyEgress InformerKey = "Egress"
	// InformerKeyIngressBackend is the InformerKey for a IngressBackend informer
	InformerKeyIngressBackend InformerKey = "IngressBackend"
	// InformerKeyUpstreamTrafficSetting is the InformerKey for a UpstreamTrafficSetting informer
	InformerKeyUpstreamTrafficSetting InformerKey = "UpstreamTrafficSetting"
	// InformerKeyRetry is the InformerKey for a Retry informer
	InformerKeyRetry InformerKey = "Retry"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL