db

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cast

func Cast[T any](o runtime.Object) (T, error)

func LoadResource

func LoadResource[T metav1.ObjectMetaAccessor](ctx context.Context, l *Loader, gvr types.GVR) error

LoadResource loads resource and save to db.

func MatchLabels

func MatchLabels(labels, sel map[string]string) bool

MatchLabels check if pod labels match a selector.

func MatchSelector

func MatchSelector(labels map[string]string, sel *metav1.LabelSelector) bool

MatchSelector check if pod labels match a selector.

func Save

func Save[T metav1.ObjectMetaAccessor](ctx context.Context, dba *DB, gvr types.GVR, oo []runtime.Object) error

Types

type CastFn

type CastFn[T any] func(o runtime.Object) (*T, error)

type ConvertFn

type ConvertFn func(o runtime.Object) (any, error)

type DB

type DB struct {
	*memdb.MemDB
}

func NewDB

func NewDB(db *memdb.MemDB) *DB

func (*DB) Dump added in v0.20.5

func (db *DB) Dump(gvr types.GVR)

func (*DB) Exists

func (db *DB) Exists(kind types.GVR, fqn string) bool

func (*DB) Find

func (db *DB) Find(kind types.GVR, fqn string) (any, error)

func (*DB) FindJobs

func (db *DB) FindJobs(fqn string) ([]*batchv1.Job, error)

func (*DB) FindNMX

func (db *DB) FindNMX(fqn string) (*mv1beta1.NodeMetrics, error)

func (*DB) FindNS

func (db *DB) FindNS(ns string) (*v1.Namespace, error)

func (*DB) FindNSBySel

func (db *DB) FindNSBySel(sel *metav1.LabelSelector) ([]*v1.Namespace, error)

func (*DB) FindNSNameBySel

func (db *DB) FindNSNameBySel(sel *metav1.LabelSelector) ([]string, error)

func (*DB) FindPMX

func (db *DB) FindPMX(fqn string) (*mv1beta1.PodMetrics, error)

func (*DB) FindPod

func (db *DB) FindPod(ns string, sel map[string]string) (*v1.Pod, error)

func (*DB) FindPods

func (db *DB) FindPods(ns string, sel map[string]string) ([]*v1.Pod, error)

func (*DB) FindPodsBySel

func (db *DB) FindPodsBySel(ns string, sel *metav1.LabelSelector) ([]*v1.Pod, error)

func (*DB) ITFor

func (db *DB) ITFor(gvr types.GVR) (*memdb.Txn, memdb.ResultIterator, error)

func (*DB) ListNMX

func (db *DB) ListNMX() ([]*mv1beta1.NodeMetrics, error)

func (*DB) ListNodes

func (db *DB) ListNodes() (map[string]*v1.Node, error)

func (*DB) MustITFor

func (db *DB) MustITFor(gvr types.GVR) (*memdb.Txn, memdb.ResultIterator)

func (*DB) MustITForNS

func (db *DB) MustITForNS(gvr types.GVR, ns string) (*memdb.Txn, memdb.ResultIterator)

type Loader

type Loader struct {
	DB *DB
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(db *DB) *Loader

func (*Loader) LoadGeneric

func (l *Loader) LoadGeneric(ctx context.Context, gvr types.GVR) error

func (*Loader) LoadNodeMX

func (l *Loader) LoadNodeMX(ctx context.Context) error

func (*Loader) LoadPodMX

func (l *Loader) LoadPodMX(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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