decorators

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ComponentLabelKeyPrefix is the key prefix used for labels marking operator component resources.
	ComponentLabelKeyPrefix = "operators.coreos.com/"
)

Variables

This section is empty.

Functions

func OperatorNames

func OperatorNames(labels map[string]string) (names []types.NamespacedName)

OperatorNames returns a list of operator names extracted from the given labels.

Types

type Component

type Component struct {
	*unstructured.Unstructured
	// contains filtered or unexported fields
}

func NewComponent

func NewComponent(component runtime.Object, scheme *runtime.Scheme) (*Component, error)

NewComponent returns a new Component instance.

func (*Component) Matches

func (c *Component) Matches(selector labels.Selector) (matches bool, err error)

func (*Component) Reference

func (c *Component) Reference() (ref *operatorsv1.RichReference, err error)

type Operator

type Operator struct {
	*operatorsv1.Operator
	// contains filtered or unexported fields
}

Operator decorates an external Operator and provides convenience methods for managing it.

func (*Operator) AddComponents

func (o *Operator) AddComponents(components ...runtime.Object) error

AddComponents adds the given components to the operator's status and returns an error if a component isn't associated with the operator by label. List type arguments are flattened to their nested elements before being added.

func (*Operator) AdoptComponent

func (o *Operator) AdoptComponent(component runtime.Object) (adopted bool, err error)

AdoptComponent adds the operator's component label to the given component, returning true if the component label was added and false if it already existed.

func (*Operator) ComponentLabelKey

func (o *Operator) ComponentLabelKey() (string, error)

ComponentLabelKey returns the operator's completed component label key.

func (*Operator) ComponentLabelSelector

func (o *Operator) ComponentLabelSelector() (*metav1.LabelSelector, error)

ComponentLabelSelector returns a LabelSelector that matches this operator's component label.

func (*Operator) ComponentSelector

func (o *Operator) ComponentSelector() (labels.Selector, error)

ComponentSelector returns a Selector that matches this operator's component label.

func (*Operator) DisownComponent

func (o *Operator) DisownComponent(component runtime.Object) (disowned bool, err error)

DisownComponent removes the operator's component label from the given component, returning true if the component label was removed and false if it wasn't present.

func (*Operator) NonComponentLabelSelector

func (o *Operator) NonComponentLabelSelector() (*metav1.LabelSelector, error)

NonComponentLabelSelector returns a LabelSelector that matches resources that do not have this operator's component label.

func (*Operator) NonComponentSelector

func (o *Operator) NonComponentSelector() (labels.Selector, error)

NonComponentSelector returns a Selector that matches resources that do not have this operator's component label.

func (*Operator) ResetComponents

func (o *Operator) ResetComponents() error

ResetComponents resets the component selector and references in the operator's status.

func (*Operator) SetComponents

func (o *Operator) SetComponents(components ...runtime.Object) error

SetComponents sets the component references in the operator's status to the given components.

type OperatorFactory

type OperatorFactory interface {
	// NewOperator returns an Operator decorator that wraps the given external Operator representation.
	// An error is returned if the decorator cannon be instantiated.
	NewOperator(external *operatorsv1.Operator) (*Operator, error)

	// NewPackageOperator returns an Operator decorator for a package and install namespace.
	NewPackageOperator(pkg, namespace string) (*Operator, error)
}

func NewSchemedOperatorFactory

func NewSchemedOperatorFactory(scheme *runtime.Scheme) (OperatorFactory, error)

NewSchemedOperatorFactory returns an OperatorFactory that supplies a scheme to all Operators it creates.

Jump to

Keyboard shortcuts

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