watcher

package
v0.0.0-...-be2e3c8 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingWLID          = fmt.Errorf("missing WLID")
	ErrMissingSlug          = fmt.Errorf("missing slug")
	ErrMissingImageTag      = fmt.Errorf("missing image ID")
	ErrMissingImageID       = fmt.Errorf("missing image tag")
	ErrMissingInstanceID    = fmt.Errorf("missing instanceID")
	ErrMissingContainerName = fmt.Errorf("missing container name")
	ErrUnsupportedObject    = errors.New("unsupported object type")
)

Functions

func ConvertUnstructuredToOperatorCommand

func ConvertUnstructuredToOperatorCommand(un *unstructured.Unstructured) (*v1alpha1.OperatorCommand, error)

Types

type CommandWatchHandler

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

func NewCommandWatchHandler

func NewCommandWatchHandler(k8sAPI *k8sinterface.KubernetesApi, config config.IConfig) *CommandWatchHandler

func (*CommandWatchHandler) AddHandler

func (cwh *CommandWatchHandler) AddHandler(obj runtime.Object)

func (*CommandWatchHandler) CommandWatch

func (cwh *CommandWatchHandler) CommandWatch(ctx context.Context)

func (*CommandWatchHandler) RegisterForCommands

func (cwh *CommandWatchHandler) RegisterForCommands(receiver chan v1alpha1.OperatorCommand)

type CooldownQueue

type CooldownQueue struct {
	ResultChan <-chan watch.Event
	// contains filtered or unexported fields
}

CooldownQueue is a queue that lets clients put events into it with a cooldown

When a client puts an event into a queue, it waits for a cooldown period before the event is forwarded to the consumer. If an event for the same key is put into the queue again before the cooldown period is over, the event is overridden and the cooldown period is reset.

func NewCooldownQueue

func NewCooldownQueue() *CooldownQueue

NewCooldownQueue returns a new Cooldown Queue

func NewCooldownQueueWithParams

func NewCooldownQueueWithParams(expiration, interval time.Duration) *CooldownQueue

func (*CooldownQueue) Closed

func (q *CooldownQueue) Closed() bool

func (*CooldownQueue) Enqueue

func (q *CooldownQueue) Enqueue(e watch.Event)

Enqueue enqueues an event in the Cooldown Queue

func (*CooldownQueue) Stop

func (q *CooldownQueue) Stop()

type OperatorCommandsHandler

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

func NewOperatorCommandsHandler

func NewOperatorCommandsHandler(ctx context.Context, pool *ants.PoolWithFunc, k8sAPI *k8sinterface.KubernetesApi, commandsWatcher *CommandWatchHandler, config config.IConfig) *OperatorCommandsHandler

func (*OperatorCommandsHandler) Start

func (ch *OperatorCommandsHandler) Start()

type RegistryCommandsHandler

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

func NewRegistryCommandsHandler

func NewRegistryCommandsHandler(ctx context.Context, k8sAPI *k8sinterface.KubernetesApi, commandsWatcher *CommandWatchHandler, config config.IConfig) *RegistryCommandsHandler

func (*RegistryCommandsHandler) Start

func (ch *RegistryCommandsHandler) Start()

type WatchHandler

type WatchHandler struct {
	SlugToImageID  maps.SafeMap[string, string] // map of <Slug> : string <image ID>
	WlidAndImageID mapset.Set[string]           // set of <wlid+imageID>
	// contains filtered or unexported fields
}

func NewWatchHandler

func NewWatchHandler(cfg config.IConfig, k8sAPI *k8sinterface.KubernetesApi, storageClient kssc.Interface, eventQueue *CooldownQueue) *WatchHandler

NewWatchHandler creates a new WatchHandler, initializes the maps and returns it

func (*WatchHandler) ApplicationProfileWatch

func (wh *WatchHandler) ApplicationProfileWatch(ctx context.Context, workerPool *ants.PoolWithFunc)

ApplicationProfileWatch watches and processes changes on ApplicationProfile resources

func (*WatchHandler) HandleApplicationProfileEvents

func (wh *WatchHandler) HandleApplicationProfileEvents(eventQueue *CooldownQueue, producedCommands chan<- *apis.Command, errorCh chan<- error)

func (*WatchHandler) HandleSBOMEvents

func (wh *WatchHandler) HandleSBOMEvents(sfEvents <-chan watch.Event, producedCommands chan<- *apis.Command, errorCh chan<- error)

func (*WatchHandler) PodWatch

func (wh *WatchHandler) PodWatch(ctx context.Context, workerPool *ants.PoolWithFunc)

func (*WatchHandler) SBOMWatch

func (wh *WatchHandler) SBOMWatch(ctx context.Context, workerPool *ants.PoolWithFunc)

SBOMWatch watches and processes changes on SBOMs

Jump to

Keyboard shortcuts

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