internal

package
v0.0.0-...-070edaf Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller is the controller implementation for managed resources.

func NewController

func NewController(
	ctx context.Context,
	options *Options,
	kubeClientset kubernetes.Interface,
	rsmClientset clientset.Interface,
	dynamicClientset dynamic.Interface,
) *Controller

NewController returns a new sample controller.

func (*Controller) Run

func (c *Controller) Run(ctx context.Context, workers int) error

Run starts the controller.

type FamilyType

type FamilyType struct {

	// Name is the Name of the metric family.
	Name string `yaml:"name"`

	// Help is the Help text for the metric family.
	Help string `yaml:"help"`

	// Metrics is a slice of Metrics that belong to the MetricType family.
	Metrics []*MetricType `yaml:"metrics"`

	// Resolver is the resolver to use to evaluate the labelset expressions.
	Resolver ResolverType `yaml:"resolver"`

	// LabelKeys is the set of inherited or defined label keys.
	LabelKeys []string `yaml:"labelKeys,omitempty"`

	// LabelValues is the set of inherited or defined label values.
	LabelValues []string `yaml:"labelValues,omitempty"`
	// contains filtered or unexported fields
}

FamilyType represents a metric family (a group of metrics with the same name).

type MetricType

type MetricType struct {

	// LabelKeys is the set of label keys.
	LabelKeys []string `yaml:"labelKeys"`

	// LabelValues is the set of label values.
	LabelValues []string `yaml:"labelValues"`

	// Value is the metric Value.
	Value string `yaml:"value"`

	// Resolver is the resolver to use to evaluate the labelset expressions.
	Resolver ResolverType `yaml:"resolver"`
}

MetricType represents a single time series.

type Options

type Options struct {
	AutoGOMAXPROCS  *bool
	RatioGOMEMLIMIT *float64
	Kubeconfig      *string
	MasterURL       *string
	SelfHost        *string
	SelfPort        *int
	MainHost        *string
	MainPort        *int
	TryNoCache      *bool
	Workers         *int
	Version         *bool
	// contains filtered or unexported fields
}

Options represents the command-line Options.

func NewOptions

func NewOptions(logger klog.Logger) *Options

NewOptions returns a new Options.

func (*Options) Read

func (o *Options) Read()

Read reads the command-line flags and applies overrides, if any.

type ResolverType

type ResolverType string

ResolverType represents the type of resolver to use to evaluate the labelset expressions.

const (

	// ResolverTypeCEL represents the CEL resolver.
	ResolverTypeCEL ResolverType = "cel"

	// ResolverTypeUnstructured represents the Unstructured resolver.
	ResolverTypeUnstructured ResolverType = "unstructured"

	// ResolverTypeNone represents an empty resolver.
	ResolverTypeNone ResolverType = ""
)

type StoreType

type StoreType struct {

	// Group is the API group of the custom resource.
	Group string `yaml:"g"`

	// Version is the API version of the custom resource.
	Version string `yaml:"v"`

	// Kind is the type of the custom resource.
	Kind string `yaml:"k"`

	// ResourceName is the name (plural) of the custom resource, in lowercase.
	ResourceName string `yaml:"r"`

	// Selectors is the selectors to use to filter the objects.
	Selectors struct {
		Label string `yaml:"label,omitempty"`
		Field string `yaml:"field,omitempty"`
	} `yaml:"selectors,omitempty"`

	// Families is a slice of metric families.
	Families []*FamilyType `yaml:"families"`

	// Resolver is the resolver to use to evaluate expressions.
	Resolver ResolverType `yaml:"resolver"`

	// LabelKeys is a slice of label keys.
	LabelKeys []string `yaml:"labelKeys,omitempty"`

	// LabelValues is a slice of label values.
	LabelValues []string `yaml:"labelValues,omitempty"`
	// contains filtered or unexported fields
}

StoreType implements the k8s.io/client-go/tools/cache.StoreType interface. The cache.Reflector uses the cache.StoreType to operate on the store.metrics map with the various metric families and their metrics based on the associated object's events.

func (*StoreType) Add

func (s *StoreType) Add(objectI interface{}) error

Add adds the given object to the accumulator associated with its key.

func (*StoreType) Delete

func (s *StoreType) Delete(objectI interface{}) error

Delete deletes the given object from the accumulator associated with its key.

func (*StoreType) Get

func (s *StoreType) Get(_ interface{}) (interface{}, bool, error)

Get returns the accumulator associated with the given object's key.

func (*StoreType) GetByKey

func (s *StoreType) GetByKey(_ string) (interface{}, bool, error)

GetByKey returns the accumulator associated with the given key.

func (*StoreType) List

func (s *StoreType) List() []interface{}

List returns a list of all the currently non-empty accumulators.

func (*StoreType) ListKeys

func (s *StoreType) ListKeys() []string

ListKeys returns a list of all the keys of the currently non-empty accumulators.

func (*StoreType) Replace

func (s *StoreType) Replace(_ []interface{}, _ string) error

Replace will delete the contents of the store, using instead the given list. store takes ownership of the list, you should not reference it after calling this function. NOTE: cache.Reflector starts off with Replace followed by Add rather than just Add, and as such this is skipped to avoid building stores twice.

func (*StoreType) Resync

func (s *StoreType) Resync() error

Resync is meaningless in the terms appearing here but has meaning in some implementations that have non-trivial additional behavior (e.g., DeltaFIFO).

func (*StoreType) Update

func (s *StoreType) Update(objectI interface{}) error

Update updates the given object in the accumulator associated with its key.

Directories

Path Synopsis
Package version prints the version metadata of the binary.
Package version prints the version metadata of the binary.

Jump to

Keyboard shortcuts

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