watchlist

package
v0.0.0-...-0f92b59 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package watchlist provides a reader for the APIServer watchlist API.

The watchlist API provides all request objects on the APIServer and streams changes to those objects as they are made. This is signficantly more efficient that the informer API, which using a bad caching implementation to cache all the objects.

In addition, this provides a reslist option that can be used to time out the current reader and create a new on underneath to refresh the view of the APIServer in case any updates were missed.

Index

Constants

View Source
const (
	// RTNode retrieves node data.
	RTNode = reader.RTNode
	// RTPod retrieves pod data.
	RTPod = reader.RTPod
	// RTNamespace retrieves namespace data.
	RTNamespace = reader.RTNamespace
	// RTPersistentVolume retrieves persistent volume data.
	RTPersistentVolume = reader.RTPersistentVolume
	// RTRBAC retrieves RBAC data. This includes all namespaced roles and cluster roles plus
	// all role bindings and cluster role bindings.
	RTRBAC = reader.RTRBAC
	// RTService retrieves service data.
	RTService = reader.RTService
	// RTDeployment retrieves deployment data.
	RTDeployment = reader.RTDeployment
	// RTIngressController retrieves ingress controller data.
	RTIngressController = reader.RTIngressController
	// RTEndpoints retrieves endpoints data.
	RTEndpoint = reader.RTEndpoint
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option = reader.Option

Option is an option for New(). Unused for now.

func WithFilterSize

func WithFilterSize(size int) Option

WithFilterSize sets the initial size of the filter map.

func WithLogger

func WithLogger(log *slog.Logger) Option

WithLogger sets the logger for the Changes object.

func WithRelist

func WithRelist(d time.Duration) Option

WithRelist will set a duration in which we will relist all the objects in the APIServer. This is useful to prevent split brain scenarios where the APIServer and tattler have different views of the world. The default is never. The minimum is 1 hour and the maximum is 7 days.

type Reader

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

Reader reports changes made to data objects on the APIServer via the watchlist API.

func New

func New(ctx context.Context, clientset *kubernetes.Clientset, retrieveTypes RetrieveType, opts ...Option) (*Reader, error)

New creates a new Reader object. retrieveTypes is a bitwise flag to determine what data to retrieve.

func (*Reader) Close

func (r *Reader) Close(ctx context.Context) error

Close closes the Reader. This will stop all watchers and close the output channel.

func (*Reader) Run

func (r *Reader) Run(ctx context.Context) error

Run starts the Reader. This will start all watchers and begin sending data to the output channel.

func (*Reader) SetOut

func (r *Reader) SetOut(ctx context.Context, out chan data.Entry) error

SetOut sets the output channel for data to flow out on.

type RetrieveType

type RetrieveType = reader.RetrieveType

RetrieveType is the type of data to retrieve. Uses as a bitwise flag. So, like: RTNode | RTPod, or RTNode, or RTPod.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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