watcher

package
v0.0.0-...-8bea463 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Objects

func Objects[T Object](list []*EnvironmentWrapper[T]) []T

Types

type Discovery

type Discovery interface {
	ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error)
}

type EnvironmentWrapper

type EnvironmentWrapper[T Object] struct {
	Cluster string
	Obj     T
}

func (EnvironmentWrapper[T]) GetName

func (e EnvironmentWrapper[T]) GetName() string

func (EnvironmentWrapper[T]) GetNamespace

func (e EnvironmentWrapper[T]) GetNamespace() string

type ErrorNotFound

type ErrorNotFound struct {
	Cluster   string
	Namespace string
	Name      string
}

func (*ErrorNotFound) As

func (e *ErrorNotFound) As(v any) bool

func (*ErrorNotFound) Error

func (e *ErrorNotFound) Error() string

func (*ErrorNotFound) GraphError

func (e *ErrorNotFound) GraphError() string

func (*ErrorNotFound) Is

func (e *ErrorNotFound) Is(v error) bool

type Filter

type Filter func(o *filterOptions)

func InCluster

func InCluster(cluster string) Filter

func WithLabels

func WithLabels(lbls labels.Selector) Filter

type ImpersonatedClientOption

type ImpersonatedClientOption func(s *impersonatedSettings)

type Manager

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

func NewManager

func NewManager(scheme *runtime.Scheme, clusterConfig kubernetes.ClusterConfigMap, log logrus.FieldLogger, opts ...Option) (*Manager, error)

func (*Manager) GetDynamicClients

func (m *Manager) GetDynamicClients() map[string]dynamic.Interface

func (*Manager) Stop

func (m *Manager) Stop()

func (*Manager) WaitForReady

func (m *Manager) WaitForReady(ctx context.Context) bool

type Object

type Object interface {
	runtime.Object
	GetName() string
	GetNamespace() string
	GetLabels() map[string]string
}

type Option

type Option func(*settings)

func WithClientCreator

func WithClientCreator(fn func(cluster string) (dynamic.Interface, Discovery, *rest.Config, error)) Option

type WatchOption

type WatchOption func(*watcherSettings)

func WithConverter

func WithConverter(fn func(o *unstructured.Unstructured, environmentName string) (obj any, ok bool)) WatchOption

func WithInformerFilter

func WithInformerFilter(labelSelector string) WatchOption

func WithTransformer

func WithTransformer(fn cache.TransformFunc) WatchOption

type Watcher

type Watcher[T Object] struct {
	// contains filtered or unexported fields
}

func Watch

func Watch[T Object](mgr *Manager, obj T, opts ...WatchOption) *Watcher[T]

func (*Watcher[T]) All

func (w *Watcher[T]) All() []*EnvironmentWrapper[T]

func (*Watcher[T]) Delete

func (w *Watcher[T]) Delete(ctx context.Context, cluster, namespace string, name string) error

func (*Watcher[T]) Enabled

func (w *Watcher[T]) Enabled() bool

func (*Watcher[T]) Get

func (w *Watcher[T]) Get(cluster, namespace, name string) (T, error)

func (*Watcher[T]) GetByCluster

func (w *Watcher[T]) GetByCluster(cluster string, filter ...Filter) []*EnvironmentWrapper[T]

func (*Watcher[T]) GetByNamespace

func (w *Watcher[T]) GetByNamespace(namespace string, filter ...Filter) []*EnvironmentWrapper[T]

func (*Watcher[T]) ImpersonatedClient

func (w *Watcher[T]) ImpersonatedClient(ctx context.Context, cluster string, opts ...ImpersonatedClientOption) (dynamic.NamespaceableResourceInterface, error)

func (*Watcher[T]) Start

func (w *Watcher[T]) Start(ctx context.Context)

func (*Watcher[T]) SystemAuthenticatedClient

func (w *Watcher[T]) SystemAuthenticatedClient(ctx context.Context, cluster string) (dynamic.NamespaceableResourceInterface, error)

Jump to

Keyboard shortcuts

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