discovery

package
v3.32.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDiscoveryTimeout = errors.New("timeout discovering endpoints")

ErrDiscoveryTimeout is returned by EndpointsDiscovererWithTimeout when discovery times out

Functions

func NewNodeLister

func NewNodeLister(client kubernetes.Interface, options ...informers.SharedInformerOption) (listersv1.NodeLister, chan<- struct{})

NewNodeLister returns a NodeGetter to get nodes with informers.

func NewServicesLister

func NewServicesLister(client kubernetes.Interface, options ...informers.SharedInformerOption) (listersv1.ServiceLister, chan<- struct{})

Types

type CachedNamespaceFilter added in v3.3.0

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

CachedNamespaceFilter holds a NamespaceCache around the NamespaceFilterer.

func NewCachedNamespaceFilter added in v3.3.0

func NewCachedNamespaceFilter(filter NamespaceFilterer, cache NamespaceCache) *CachedNamespaceFilter

NewCachedNamespaceFilter create a new CachedNamespaceFilter, wrapping the cache and the NamespaceFilterer.

func (*CachedNamespaceFilter) IsAllowed added in v3.3.0

func (cm *CachedNamespaceFilter) IsAllowed(namespace string) bool

IsAllowed looks for a match in the cache first, otherwise calls the filter.

type EndpointsDiscoverer

type EndpointsDiscoverer interface {
	Discover() ([]string, error)
}

func NewEndpointsDiscoverer

func NewEndpointsDiscoverer(config EndpointsDiscoveryConfig) (EndpointsDiscoverer, error)

type EndpointsDiscovererWithTimeout

type EndpointsDiscovererWithTimeout struct {
	EndpointsDiscoverer
	BackoffDelay time.Duration
	Timeout      time.Duration
}

EndpointsDiscovererWithTimeout implements EndpointsDiscoverer with a retry mechanism if no endpoints are found.

func (*EndpointsDiscovererWithTimeout) Discover

func (edt *EndpointsDiscovererWithTimeout) Discover() ([]string, error)

Discover will call poll the inner EndpointsDiscoverer every BackoffDelay seconds up to a max of Retries times until it returns an error, or a non-empty list of endpoints. If the max number of Retries is exceeded, it will return ErrDiscoveryTimeout.

type EndpointsDiscoveryConfig

type EndpointsDiscoveryConfig struct {
	// LabelSelector is the selector used to filter Endpoints.
	LabelSelector string
	// Namespace can be used to restric the search to a particular namespace.
	Namespace string
	// If set, Port will discard all endpoints discovered that do not use this specified port
	Port int

	// Client is the Kubernetes client.Interface used to build informers.
	Client kubernetes.Interface
}

type MultiNamespacePodListerer

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

MultiNamespacePodListerer implements PodListerer interface for a group of listers pre-build on initialization.

func NewNamespacePodListerer

func NewNamespacePodListerer(config PodListererConfig) (*MultiNamespacePodListerer, chan<- struct{})

NewNamespacePodListerer returns a MultiNamespacePodListerer with listers for all namespaces on config.Namespaces.

func (MultiNamespacePodListerer) Lister

Lister returns the available lister based on the namespace if exists in the listerer.

type MultiNamespaceSecretListerer

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

MultiNamespaceSecretListerer implements SecretListerer interface for a group of listers pre-build on initialization.

func NewNamespaceSecretListerer

func NewNamespaceSecretListerer(config SecretListererConfig) (*MultiNamespaceSecretListerer, chan<- struct{})

NewNamespaceSecretListerer returns a MultiNamespaceSecretListerer with listers for all namespaces on config.Namespaces.

func (MultiNamespaceSecretListerer) Lister

Lister returns the available lister based on the namespace if exists in the listerer.

type NamespaceCache added in v3.3.0

type NamespaceCache interface {
	Put(namespace string, match bool)
	Match(namespace string) (bool, bool)
	Vacuum()
}

NamespaceCache provides an interface to add and retrieve namespaces from the cache.

type NamespaceFilter added in v3.3.0

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

NamespaceFilter is a struct holding pointers to the config and the namespace lister.

func NewNamespaceFilter added in v3.3.0

func NewNamespaceFilter(c *config.NamespaceSelector, client kubernetes.Interface, logger *log.Logger, options ...informers.SharedInformerOption) *NamespaceFilter

NewNamespaceFilter inits the namespace lister and returns a new NamespaceFilter.

func (*NamespaceFilter) Close added in v3.3.0

func (nf *NamespaceFilter) Close() error

Close closes the stop channel and implements the Closer interface.

func (*NamespaceFilter) IsAllowed added in v3.3.0

func (nf *NamespaceFilter) IsAllowed(namespace string) bool

IsAllowed checks if a namespace is allowed to be scraped given a certain match labels or expressions configuration.

type NamespaceFilterer added in v3.3.0

type NamespaceFilterer interface {
	IsAllowed(namespace string) bool
}

NamespaceFilterer provides an interface to filter from a given namespace.

type NamespaceInMemoryStore added in v3.3.0

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

func NewNamespaceInMemoryStore added in v3.3.0

func NewNamespaceInMemoryStore(logger *logrus.Logger) *NamespaceInMemoryStore

func (*NamespaceInMemoryStore) Match added in v3.3.0

func (m *NamespaceInMemoryStore) Match(namespace string) (bool, bool)

func (*NamespaceInMemoryStore) Put added in v3.3.0

func (m *NamespaceInMemoryStore) Put(namespace string, match bool)

func (*NamespaceInMemoryStore) Vacuum added in v3.3.0

func (m *NamespaceInMemoryStore) Vacuum()

Vacuum removes the cached data entries on each interval.

type PodListerer

type PodListerer interface {
	// Lister ruturns the pod lister for the specified namespaces
	// and true if the lister exist in the listerer.
	Lister(namespace string) (listersv1.PodNamespaceLister, bool)
}

PodListerer return namespaced pod listers.

type PodListererConfig

type PodListererConfig struct {
	// Namespaces supported by the listerer.
	Namespaces []string
	// Client is the Kubernetes client.Interface used to build informers.
	Client kubernetes.Interface
}

type SecretListerer

type SecretListerer interface {
	// Lister ruturns the secret lister for the specified namespaces
	// and true if the lister exist in the listerer.
	Lister(namespace string) (listersv1.SecretNamespaceLister, bool)
}

SecretListerer return namespaced secret listers.

type SecretListererConfig

type SecretListererConfig struct {
	// Namespaces supported by the listerer.
	Namespaces []string
	// Client is the Kubernetes client.Interface used to build informers.
	Client kubernetes.Interface
}

Jump to

Keyboard shortcuts

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