watch

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

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

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

Documentation

Index

Constants

View Source
const (
	// ContainerIndex marker for stored containers.
	ContainerIndex string = "co"
)
View Source
const (
	// NodeIndex marker for stored nodes.
	NodeIndex string = "no"
)
View Source
const (
	// NodeMXIndex track store indexer.
	NodeMXIndex string = "nmx"
)
View Source
const (
	// PodIndex marker for stored pods.
	PodIndex string = "po"
)
View Source
const (
	// PodMXIndex track store indexer.
	PodMXIndex string = "pmx"
)

Variables

This section is empty.

Functions

func MetaFQN

func MetaFQN(m metav1.ObjectMeta) string

MetaFQN computes unique resource id based on metadata.

Types

type Connection

type Connection k8s.Connection

Connection represents an client api server connection.

type Container

type Container struct {
	StoreInformer
}

Container tracks container activities.

func NewContainer

func NewContainer(po StoreInformer) *Container

NewContainer returns a new container.

func (*Container) Get

func (c *Container) Get(fqn string, opts metav1.GetOptions) (interface{}, error)

Get retrieves a given container from store.

func (*Container) List

func (c *Container) List(fqn string, opts metav1.ListOptions) k8s.Collection

List retrieves alist of containers for a given po from store.

func (*Container) Run

func (c *Container) Run(closeCh <-chan struct{})

Run starts out the informer loop.

func (*Container) StartWatching

func (c *Container) StartWatching(stopCh <-chan struct{})

StartWatching registers container event listener.

type Informer

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

Informer represents a collection of cluster wide watchers.

func NewInformer

func NewInformer(client k8s.Connection, ns string) (*Informer, error)

NewInformer creates a new cluster resource informer

func (*Informer) Get

func (i *Informer) Get(res, fqn string, opts metav1.GetOptions) (interface{}, error)

Get a resource by name.

func (*Informer) List

func (i *Informer) List(res, ns string, opts metav1.ListOptions) (k8s.Collection, error)

List items from store.

func (*Informer) Run

func (i *Informer) Run(closeCh <-chan struct{})

Run starts watching cluster resources.

type Node

type Node struct {
	cache.SharedIndexInformer
}

Node tracks node activities.

func NewNode

func NewNode(c k8s.Connection) *Node

NewNode returns a new node.

func (*Node) Get

func (n *Node) Get(fqn string, opts metav1.GetOptions) (interface{}, error)

Get retrieves a given node from store.

func (*Node) List

func (n *Node) List(_ string, opts metav1.ListOptions) k8s.Collection

List all nodes.

type NodeMetrics

type NodeMetrics struct {
	cache.SharedIndexInformer
	// contains filtered or unexported fields
}

NodeMetrics tracks node metrics.

func NewNodeMetrics

func NewNodeMetrics(c k8s.Connection) *NodeMetrics

NewNodeMetrics returns a node metrics informer.

func (*NodeMetrics) Get

func (p *NodeMetrics) Get(MetaFQN string, opts metav1.GetOptions) (interface{}, error)

Get node metrics from store.

func (*NodeMetrics) List

List node metrics from store.

type Pod

type Pod struct {
	cache.SharedIndexInformer
}

Pod tracks pod activities.

func NewPod

func NewPod(c Connection, ns string) *Pod

NewPod returns a new pod.

func (*Pod) Get

func (p *Pod) Get(fqn string, opts metav1.GetOptions) (interface{}, error)

Get retrieves a given pod from store.

func (*Pod) List

func (p *Pod) List(ns string, opts metav1.ListOptions) k8s.Collection

List all pods from store in the given namespace.

type PodMetrics

type PodMetrics struct {
	cache.SharedIndexInformer
	// contains filtered or unexported fields
}

PodMetrics tracks pod metrics.

func NewPodMetrics

func NewPodMetrics(c k8s.Connection, ns string) *PodMetrics

NewPodMetrics returns a pod metrics informer.

func (*PodMetrics) Get

func (p *PodMetrics) Get(fqn string, opts metav1.GetOptions) (interface{}, error)

Get pod metrics from store.

func (*PodMetrics) List

func (p *PodMetrics) List(ns string, opts metav1.ListOptions) k8s.Collection

List pod metrics from store.

type Row

type Row []string

Row represents a collection of string fields.

type RowEvent

type RowEvent struct {
	Action watch.EventType
	Fields Row
	Deltas Row
}

RowEvent represents a call for action after a resource reconciliation. Tracks whether a resource got added, deleted or updated.

type RowEvents

type RowEvents map[string]*RowEvent

RowEvents tracks resource update events.

type StoreInformer

type StoreInformer interface {
	cache.SharedIndexInformer
	Get(fqn string, opts metav1.GetOptions) (interface{}, error)
	List(ns string, opts metav1.ListOptions) k8s.Collection
}

StoreInformer an informer that allows listeners registration.

type TableData

type TableData struct {
	Header    Row
	Rows      RowEvents
	Namespace string
}

TableData tracks a K8s resource for tabular display.

type TableListenerFn

type TableListenerFn func(TableData)

TableListenerFn represents a table data listener.

Jump to

Keyboard shortcuts

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