watcher

package
v0.0.0-...-346986a Latest Latest
Warning

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

Go to latest
Published: Nov 21, 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 DataStore

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

func NewDataStore

func NewDataStore[T Object]() *DataStore[T]

func (*DataStore[T]) Add

func (d *DataStore[T]) Add(cluster string, obj T)

func (*DataStore[T]) All

func (d *DataStore[T]) All() []*EnvironmentWrapper[T]

func (*DataStore[T]) Get

func (d *DataStore[T]) Get(cluster, namespace, name string) (T, error)

func (*DataStore[T]) GetByCluster

func (d *DataStore[T]) GetByCluster(cluster string, filters ...Filter) []*EnvironmentWrapper[T]

func (*DataStore[T]) GetByNamespace

func (d *DataStore[T]) GetByNamespace(namespace string, filters ...Filter) []*EnvironmentWrapper[T]

func (*DataStore[T]) Remove

func (d *DataStore[T]) Remove(cluster string, obj T)

func (*DataStore[T]) Update

func (d *DataStore[T]) Update(cluster string, obj T)

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(obj Object, cluster string) bool

func InCluster

func InCluster(clusterName string) Filter

func WithLabels

func WithLabels(lbls labels.Selector) Filter

func WithObjectNames

func WithObjectNames(objectNames []string) Filter

type ImpersonatedClientOption

type ImpersonatedClientOption func(s *impersonatedSettings)

type List

type List[T Object] []*EnvironmentWrapper[T]

func (List[T]) Clone

func (l List[T]) Clone() []*EnvironmentWrapper[T]

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

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]) 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