Documentation ¶
Overview ¶
Package informers centralize informers by creating a single object that runs a set of informers, instead of creating different objects that each manage their own informer collections. A pointer to this object is then shared with all objects that need it.
Index ¶
- Constants
- type GatewayAPIResource
- type InformerCollection
- func (ic *InformerCollection) Add(key InformerKey, obj interface{}, t *testing.T) error
- func (ic *InformerCollection) AddEventHandler(informerKey InformerKey, handler cache.ResourceEventHandler)
- func (ic *InformerCollection) GetByKey(informerKey InformerKey, objectKey string) (interface{}, bool, error)
- func (ic *InformerCollection) GetGatewayResourcesFromCache(resourceType ResourceType, shouldSort bool) []client.Object
- func (ic *InformerCollection) GetListers() *Lister
- func (ic *InformerCollection) IsMonitoredNamespace(namespace string) bool
- func (ic *InformerCollection) List(informerKey InformerKey) []interface{}
- func (ic *InformerCollection) Update(key InformerKey, obj interface{}, t *testing.T) error
- type InformerCollectionOption
- func WithConfigClient(configClient configClientset.Interface, meshConfigName, fsmNamespace string) InformerCollectionOption
- func WithConnectorClient(connectorClient connectorClientset.Interface) InformerCollectionOption
- func WithGatewayAPIClient(gatewayAPIClient gatewayApiClientset.Interface) InformerCollectionOption
- func WithIngressClient(kubeClient kubernetes.Interface, nsigClient nsigClientset.Interface) InformerCollectionOption
- func WithKubeClient(kubeClient kubernetes.Interface) InformerCollectionOption
- func WithKubeClientWithoutNamespace(kubeClient kubernetes.Interface) InformerCollectionOption
- func WithMachineClient(machineClient machineClientset.Interface) InformerCollectionOption
- func WithMultiClusterClient(multiclusterClient multiclusterClientset.Interface) InformerCollectionOption
- func WithNetworkingClient(networkingClient networkingClientset.Interface) InformerCollectionOption
- func WithPluginClient(pluginClient pluginClientset.Interface) InformerCollectionOption
- func WithPolicyAttachmentClient(policyAttachmentClient policyAttachmentClientset.Interface) InformerCollectionOption
- func WithPolicyClient(policyClient policyClientset.Interface) InformerCollectionOption
- func WithSMIClients(smiTrafficSplitClient smiTrafficSplitClient.Interface, ...) InformerCollectionOption
- type InformerKey
- type Lister
- type ResourceType
Constants ¶
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 GatewayAPIResource ¶ added in v1.3.0
type GatewayAPIResource interface { *gwv1.HTTPRoute | *gwv1alpha2.GRPCRoute | *gwv1alpha2.TLSRoute | *gwv1alpha2.TCPRoute | *gwv1alpha2.UDPRoute | *gwv1beta1.ReferenceGrant | *gwpav1alpha1.RateLimitPolicy | *gwpav1alpha1.SessionStickyPolicy | *gwpav1alpha1.LoadBalancerPolicy | *gwpav1alpha1.CircuitBreakingPolicy | *gwpav1alpha1.AccessControlPolicy | *gwpav1alpha1.HealthCheckPolicy | *gwpav1alpha1.FaultInjectionPolicy | *gwpav1alpha1.UpstreamTLSPolicy | *gwpav1alpha1.RetryPolicy | *gwpav1alpha1.GatewayTLSPolicy }
GatewayAPIResource is the type used to represent the Gateway API resource
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) GetGatewayResourcesFromCache ¶ added in v1.3.0
func (ic *InformerCollection) GetGatewayResourcesFromCache(resourceType ResourceType, shouldSort bool) []client.Object
func (*InformerCollection) GetListers ¶ added in v1.1.0
func (ic *InformerCollection) GetListers() *Lister
GetListers returns the listers for the informers
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, fsmNamespace string) InformerCollectionOption
WithConfigClient sets the config client for the InformerCollection
func WithConnectorClient ¶ added in v1.2.1
func WithConnectorClient(connectorClient connectorClientset.Interface) InformerCollectionOption
WithConnectorClient sets the connector client for the InformerCollection
func WithGatewayAPIClient ¶ added in v1.1.0
func WithGatewayAPIClient(gatewayAPIClient gatewayApiClientset.Interface) InformerCollectionOption
WithGatewayAPIClient sets the gateway api client for the InformerCollection
func WithIngressClient ¶ added in v1.1.0
func WithIngressClient(kubeClient kubernetes.Interface, nsigClient nsigClientset.Interface) InformerCollectionOption
WithIngressClient sets the networking client for the InformerCollection
func WithKubeClient ¶
func WithKubeClient(kubeClient kubernetes.Interface) InformerCollectionOption
WithKubeClient sets the kubeClient for the InformerCollection
func WithKubeClientWithoutNamespace ¶ added in v1.1.0
func WithKubeClientWithoutNamespace(kubeClient kubernetes.Interface) InformerCollectionOption
WithKubeClientWithoutNamespace sets the kubeClient for the InformerCollection
func WithMachineClient ¶ added in v1.2.0
func WithMachineClient(machineClient machineClientset.Interface) InformerCollectionOption
WithMachineClient sets the machine client for the InformerCollection
func WithMultiClusterClient ¶
func WithMultiClusterClient(multiclusterClient multiclusterClientset.Interface) InformerCollectionOption
WithMultiClusterClient sets the multicluster client for the InformerCollection
func WithNetworkingClient ¶
func WithNetworkingClient(networkingClient networkingClientset.Interface) InformerCollectionOption
WithNetworkingClient sets the networking client for the InformerCollection
func WithPluginClient ¶
func WithPluginClient(pluginClient pluginClientset.Interface) InformerCollectionOption
WithPluginClient sets the plugin client for the InformerCollection
func WithPolicyAttachmentClient ¶ added in v1.2.0
func WithPolicyAttachmentClient(policyAttachmentClient policyAttachmentClientset.Interface) InformerCollectionOption
WithPolicyAttachmentClient sets the PolicyAttachment client 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" // InformerKeyNamespaceAll is the InformerKey for all Namespaces informer InformerKeyNamespaceAll InformerKey = "NamespaceAll" // 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" // InformerKeyEndpointSlices is the InformerKey for a EndpointSlices informer InformerKeyEndpointSlices InformerKey = "EndpointSlices" // InformerKeyServiceAccount is the InformerKey for a ServiceAccount informer InformerKeyServiceAccount InformerKey = "ServiceAccount" // InformerKeySecret is the InformerKey for a Secret informer InformerKeySecret InformerKey = "Secret" // 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 an Egress informer InformerKeyEgress InformerKey = "Egress" // InformerKeyEgressGateway is the InformerKey for an EgressGateway informer InformerKeyEgressGateway InformerKey = "EgressGateway" // 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" // InformerKeyAccessControl is the InformerKey for a AccessControl informer InformerKeyAccessControl InformerKey = "AccessControl" // InformerKeyAccessCert is the InformerKey for a AccessCert informer InformerKeyAccessCert InformerKey = "AccessCert" // InformerKeyServiceImport is the InformerKey for a ServiceImport informer InformerKeyServiceImport InformerKey = "ServiceImport" // InformerKeyServiceExport is the InformerKey for a ServiceExport informer InformerKeyServiceExport InformerKey = "ServiceExport" // InformerKeyGlobalTrafficPolicy is the InformerKey for a GlobalTrafficPolicy informer InformerKeyGlobalTrafficPolicy InformerKey = "GlobalTrafficPolicy" // InformerKeyIngressClass is the InformerKey for a IngressClass informer InformerKeyIngressClass InformerKey = "IngressClass" // InformerKeyPlugin is the InformerKey for a Plugin informer InformerKeyPlugin InformerKey = "Plugin" // InformerKeyPluginChain is the InformerKey for a PluginChain informer InformerKeyPluginChain InformerKey = "PluginChain" // InformerKeyPluginConfig is the InformerKey for a PluginConfig informer InformerKeyPluginConfig InformerKey = "PluginConfig" // InformerKeyVirtualMachine is the InformerKey for a VirtualMachine informer InformerKeyVirtualMachine InformerKey = "VirtualMachine" // InformerKeyConsulConnector is the InformerKey for a ConsulConnector informer InformerKeyConsulConnector InformerKey = "ConsulConnector" // InformerKeyEurekaConnector is the InformerKey for a EurekaConnector informer InformerKeyEurekaConnector InformerKey = "EurekaConnector" // InformerKeyNacosConnector is the InformerKey for a NacosConnector informer InformerKeyNacosConnector InformerKey = "NacosConnector" // InformerKeyMachineConnector is the InformerKey for a MachineConnector informer InformerKeyMachineConnector InformerKey = "MachineConnector" // InformerKeyGatewayConnector is the InformerKey for a GatewayConnector informer InformerKeyGatewayConnector InformerKey = "GatewayConnector" // InformerKeyK8sIngressClass is the InformerKey for a k8s IngressClass informer InformerKeyK8sIngressClass InformerKey = "IngressClass-k8s" // InformerKeyK8sIngress is the InformerKey for a k8s Ingress informer InformerKeyK8sIngress InformerKey = "Ingress-k8s" // InformerKeyNamespacedIngress is the InformerKey for a NamespacedIngress informer InformerKeyNamespacedIngress InformerKey = "NamespacedIngress" // InformerKeyGatewayAPIGatewayClass is the InformerKey for a GatewayClass informer InformerKeyGatewayAPIGatewayClass InformerKey = "GatewayClass-gwapi" // InformerKeyGatewayAPIGateway is the InformerKey for a Gateway informer InformerKeyGatewayAPIGateway InformerKey = "Gateway-gwapi" // InformerKeyGatewayAPIHTTPRoute is the InformerKey for a HTTPRoute informer InformerKeyGatewayAPIHTTPRoute InformerKey = "HTTPRoute-gwapi" // InformerKeyGatewayAPIGRPCRoute is the InformerKey for a GRPCRoute informer InformerKeyGatewayAPIGRPCRoute InformerKey = "GRPCRoute-gwapi" // InformerKeyGatewayAPITLSRoute is the InformerKey for a TLSRoute informer InformerKeyGatewayAPITLSRoute InformerKey = "TLSRoute-gwapi" // InformerKeyGatewayAPITCPRoute is the InformerKey for a TCPRoute informer InformerKeyGatewayAPITCPRoute InformerKey = "TCPRoute-gwapi" // InformerKeyGatewayAPIUDPRoute is the InformerKey for a UDPRoute informer InformerKeyGatewayAPIUDPRoute InformerKey = "UDPRoute-gwapi" // InformerKeyGatewayAPIReferenceGrant is the InformerKey for a ReferenceGrant informer InformerKeyGatewayAPIReferenceGrant InformerKey = "ReferenceGrant-gwapi" // InformerKeyRateLimitPolicy is the InformerKey for a RateLimitPolicy informer InformerKeyRateLimitPolicy InformerKey = "RateLimitPolicy" // InformerKeySessionStickyPolicy is the InformerKey for a SessionStickyPolicy informer InformerKeySessionStickyPolicy InformerKey = "SessionStickyPolicy" // InformerKeyLoadBalancerPolicy is the InformerKey for a LoadBalancerPolicy informer InformerKeyLoadBalancerPolicy InformerKey = "LoadBalancerPolicy" // InformerKeyCircuitBreakingPolicy is the InformerKey for a CircuitBreakingPolicy informer InformerKeyCircuitBreakingPolicy InformerKey = "CircuitBreakingPolicy" // InformerKeyAccessControlPolicy is the InformerKey for a AccessControlPolicy informer InformerKeyAccessControlPolicy InformerKey = "AccessControlPolicy" // InformerKeyHealthCheckPolicy is the InformerKey for a HealthCheckPolicy informer InformerKeyHealthCheckPolicy InformerKey = "HealthCheckPolicy" // InformerKeyFaultInjectionPolicy is the InformerKey for a FaultInjectionPolicy informer InformerKeyFaultInjectionPolicy InformerKey = "FaultInjectionPolicy" // InformerKeyUpstreamTLSPolicy is the InformerKey for a UpstreamTLSPolicy informer InformerKeyUpstreamTLSPolicy InformerKey = "UpstreamTLSPolicy" // InformerKeyRetryPolicy is the InformerKey for a RetryPolicy informer InformerKeyRetryPolicy InformerKey = "RetryPolicy" // InformerKeyGatewayTLSPolicy is the InformerKey for a GatewayTLSPolicy informer InformerKeyGatewayTLSPolicy InformerKey = "GatewayTLSPolicy" )
type Lister ¶ added in v1.1.0
type Lister struct { Service v1.ServiceLister ServiceImport mcsv1alpha1.ServiceImportLister Endpoints v1.EndpointsLister EndpointSlice discoveryv1.EndpointSliceLister Secret v1.SecretLister GatewayClass gwv1lister.GatewayClassLister Gateway gwv1lister.GatewayLister HTTPRoute gwv1lister.HTTPRouteLister GRPCRoute gwv1alpha2lister.GRPCRouteLister TLSRoute gwv1alpha2lister.TLSRouteLister TCPRoute gwv1alpha2lister.TCPRouteLister UDPRoute gwv1alpha2lister.UDPRouteLister K8sIngressClass networkingv1.IngressClassLister K8sIngress networkingv1.IngressLister NamespacedIngress nsigv1alpha1.NamespacedIngressLister RateLimitPolicy gwpav1alpha1lister.RateLimitPolicyLister SessionStickyPolicy gwpav1alpha1lister.SessionStickyPolicyLister LoadBalancerPolicy gwpav1alpha1lister.LoadBalancerPolicyLister CircuitBreakingPolicy gwpav1alpha1lister.CircuitBreakingPolicyLister AccessControlPolicy gwpav1alpha1lister.AccessControlPolicyLister HealthCheckPolicy gwpav1alpha1lister.HealthCheckPolicyLister FaultInjectionPolicy gwpav1alpha1lister.FaultInjectionPolicyLister UpstreamTLSPolicy gwpav1alpha1lister.UpstreamTLSPolicyLister RetryPolicy gwpav1alpha1lister.RetryPolicyLister GatewayTLSPolicy gwpav1alpha1lister.GatewayTLSPolicyLister ReferenceGrant gwv1beta1lister.ReferenceGrantLister Namespace v1.NamespaceLister }
Lister is the listers for the informers in the collection
type ResourceType ¶ added in v1.3.0
type ResourceType string
ResourceType is the type used to represent the type of resource
const ( // ServicesResourceType is the type used to represent the services resource ServicesResourceType ResourceType = "services" // EndpointSlicesResourceType is the type used to represent the endpoint slices resource EndpointSlicesResourceType ResourceType = "endpointslices" // EndpointsResourceType is the type used to represent the endpoints resource EndpointsResourceType ResourceType = "endpoints" // ServiceImportsResourceType is the type used to represent the service imports resource ServiceImportsResourceType ResourceType = "serviceimports" // SecretsResourceType is the type used to represent the secrets resource SecretsResourceType ResourceType = "secrets" // GatewayClassesResourceType is the type used to represent the gateway classes resource GatewayClassesResourceType ResourceType = "gatewayclasses" // GatewaysResourceType is the type used to represent the gateways resource GatewaysResourceType ResourceType = "gateways" // HTTPRoutesResourceType is the type used to represent the HTTP routes resource HTTPRoutesResourceType ResourceType = "httproutes" // GRPCRoutesResourceType is the type used to represent the gRPC routes resource GRPCRoutesResourceType ResourceType = "grpcroutes" // TCPRoutesResourceType is the type used to represent the TCP routes resource TCPRoutesResourceType ResourceType = "tcproutes" // TLSRoutesResourceType is the type used to represent the TLS routes resource TLSRoutesResourceType ResourceType = "tlsroutes" // UDPRoutesResourceType is the type used to represent the UDP routes resource UDPRoutesResourceType ResourceType = "udproutes" // ReferenceGrantResourceType is the type used to represent the reference grants resource ReferenceGrantResourceType ResourceType = "referencegrants" // RateLimitPoliciesResourceType is the type used to represent the rate limit policies resource RateLimitPoliciesResourceType ResourceType = "ratelimits" // SessionStickyPoliciesResourceType is the type used to represent the session sticky policies resource SessionStickyPoliciesResourceType ResourceType = "sessionstickies" // LoadBalancerPoliciesResourceType is the type used to represent the load balancer policies resource LoadBalancerPoliciesResourceType ResourceType = "loadbalancers" // CircuitBreakingPoliciesResourceType is the type used to represent the circuit breaking policies resource CircuitBreakingPoliciesResourceType ResourceType = "circuitbreakings" // AccessControlPoliciesResourceType is the type used to represent the access control policies resource AccessControlPoliciesResourceType ResourceType = "accesscontrols" // HealthCheckPoliciesResourceType is the type used to represent the health check policies resource HealthCheckPoliciesResourceType ResourceType = "healthchecks" // FaultInjectionPoliciesResourceType is the type used to represent the fault injection policies resource FaultInjectionPoliciesResourceType ResourceType = "faultinjections" // UpstreamTLSPoliciesResourceType is the type used to represent the upstream tls policies resource UpstreamTLSPoliciesResourceType ResourceType = "upstreamtls" // RetryPoliciesResourceType is the type used to represent the retry policies resource RetryPoliciesResourceType ResourceType = "retries" // GatewayTLSPoliciesResourceType is the type used to represent the gateway tls policies resource GatewayTLSPoliciesResourceType ResourceType = "gatewaytls" )