v1helpers

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

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureOperatorConfigExists

func EnsureOperatorConfigExists(client dynamic.Interface, operatorConfigBytes []byte, gvr schema.GroupVersionResource)

func FindOperandVersion

func FindOperandVersion(versions []configv1.OperandVersion, name string) *configv1.OperandVersion

func FindOperatorCondition

func FindOperatorCondition(conditions []operatorv1.OperatorCondition, conditionType string) *operatorv1.OperatorCondition

func IsOperatorConditionFalse

func IsOperatorConditionFalse(conditions []operatorv1.OperatorCondition, conditionType string) bool

func IsOperatorConditionPresentAndEqual

func IsOperatorConditionPresentAndEqual(conditions []operatorv1.OperatorCondition, conditionType string, status operatorv1.ConditionStatus) bool

func IsOperatorConditionTrue

func IsOperatorConditionTrue(conditions []operatorv1.OperatorCondition, conditionType string) bool

func NewFakeNodeLister

func NewFakeNodeLister(client kubernetes.Interface) corev1listers.NodeLister

NewFakeNodeLister returns a fake node lister suitable to use in node controller unit test

func NewFakeSharedIndexInformer

func NewFakeSharedIndexInformer() cache.SharedIndexInformer

NewFakeSharedIndexInformer returns a fake shared index informer, suitable to use in static pod controller unit tests.

func NewMultiLineAggregate

func NewMultiLineAggregate(errList []error) error

NewMultiLineAggregate returns an aggregate error with multi-line output

func RemoveOperatorCondition

func RemoveOperatorCondition(conditions *[]operatorv1.OperatorCondition, conditionType string)

func SetOperandVersion

func SetOperandVersion(versions *[]configv1.OperandVersion, operandVersion configv1.OperandVersion)

func SetOperatorCondition

func SetOperatorCondition(conditions *[]operatorv1.OperatorCondition, newCondition operatorv1.OperatorCondition)

func UpdateSpec

func UpdateSpec(client OperatorClient, updateFuncs ...UpdateOperatorSpecFunc) (*operatorv1.OperatorSpec, bool, error)

UpdateSpec applies the update funcs to the oldStatus and tries to update via the client.

func UpdateStaticPodStatus

func UpdateStaticPodStatus(client StaticPodOperatorClient, updateFuncs ...UpdateStaticPodStatusFunc) (*operatorv1.StaticPodOperatorStatus, bool, error)

UpdateStaticPodStatus applies the update funcs to the oldStatus abd tries to update via the client.

func UpdateStatus

func UpdateStatus(client OperatorClient, updateFuncs ...UpdateStatusFunc) (*operatorv1.OperatorStatus, bool, error)

UpdateStatus applies the update funcs to the oldStatus and tries to update via the client.

Types

type KubeInformersForNamespaces

type KubeInformersForNamespaces interface {
	Start(stopCh <-chan struct{})
	InformersFor(namespace string) informers.SharedInformerFactory
	Namespaces() sets.String

	ConfigMapLister() corev1listers.ConfigMapLister
	SecretLister() corev1listers.SecretLister
}

KubeInformersForNamespaces is a simple way to combine several shared informers into a single struct with unified listing power

func NewFakeKubeInformersForNamespaces

func NewFakeKubeInformersForNamespaces(informers map[string]informers.SharedInformerFactory) KubeInformersForNamespaces

func NewKubeInformersForNamespaces

func NewKubeInformersForNamespaces(kubeClient kubernetes.Interface, namespaces ...string) KubeInformersForNamespaces

type OperatorClient

type OperatorClient interface {
	Informer() cache.SharedIndexInformer
	// GetOperatorState returns the operator spec, status and the resource version, potentially from a lister.
	GetOperatorState() (spec *operatorv1.OperatorSpec, status *operatorv1.OperatorStatus, resourceVersion string, err error)
	// UpdateOperatorSpec updates the spec of the operator, assuming the given resource verison.
	UpdateOperatorSpec(oldResourceVersion string, in *operatorv1.OperatorSpec) (out *operatorv1.OperatorSpec, newResourceVersion string, err error)
	// UpdateOperatorStatus updates the status of the operator, assuming the given resource verison.
	UpdateOperatorStatus(oldResourceVersion string, in *operatorv1.OperatorStatus) (out *operatorv1.OperatorStatus, err error)
}

func NewFakeOperatorClient

func NewFakeOperatorClient(spec *operatorv1.OperatorSpec, status *operatorv1.OperatorStatus, triggerErr func(rv string, status *operatorv1.OperatorStatus) error) OperatorClient

NewFakeOperatorClient returns a fake operator client suitable to use in static pod controller unit tests.

type StaticPodOperatorClient

type StaticPodOperatorClient interface {
	OperatorClient
	// GetStaticPodOperatorState returns the static pod operator spec, status and the resource version,
	// potentially from a lister.
	GetStaticPodOperatorState() (spec *operatorv1.StaticPodOperatorSpec, status *operatorv1.StaticPodOperatorStatus, resourceVersion string, err error)
	// GetStaticPodOperatorStateWithQuorum return the static pod operator spec, status and resource version
	// directly from a server read.
	GetStaticPodOperatorStateWithQuorum() (spec *operatorv1.StaticPodOperatorSpec, status *operatorv1.StaticPodOperatorStatus, resourceVersion string, err error)
	// UpdateStaticPodOperatorStatus updates the status, assuming the given resource version.
	UpdateStaticPodOperatorStatus(resourceVersion string, in *operatorv1.StaticPodOperatorStatus) (out *operatorv1.StaticPodOperatorStatus, err error)
}

func NewFakeStaticPodOperatorClient

func NewFakeStaticPodOperatorClient(spec *operatorv1.OperatorSpec, status *operatorv1.OperatorStatus,
	staticPodSpec *operatorv1.StaticPodOperatorSpec, staticPodStatus *operatorv1.StaticPodOperatorStatus,
	triggerErr func(rv string, status *operatorv1.StaticPodOperatorStatus) error) StaticPodOperatorClient

NewFakeStaticPodOperatorClient returns a fake operator client suitable to use in static pod controller unit tests.

type UpdateOperatorSpecFunc

type UpdateOperatorSpecFunc func(spec *operatorv1.OperatorSpec) error

UpdateOperatorSpecFunc is a func that mutates an operator spec.

func UpdateObservedConfigFn

func UpdateObservedConfigFn(config map[string]interface{}) UpdateOperatorSpecFunc

UpdateSpecConfigFn returns a func to update the config.

type UpdateStaticPodStatusFunc

type UpdateStaticPodStatusFunc func(status *operatorv1.StaticPodOperatorStatus) error

UpdateStatusFunc is a func that mutates an operator status.

func UpdateStaticPodConditionFn

func UpdateStaticPodConditionFn(cond operatorv1.OperatorCondition) UpdateStaticPodStatusFunc

UpdateStaticPodConditionFn returns a func to update a condition.

type UpdateStatusFunc

type UpdateStatusFunc func(status *operatorv1.OperatorStatus) error

UpdateStatusFunc is a func that mutates an operator status.

func UpdateConditionFn

func UpdateConditionFn(cond operatorv1.OperatorCondition) UpdateStatusFunc

UpdateConditionFunc returns a func to update a condition.

Jump to

Keyboard shortcuts

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