Documentation ¶
Index ¶
- func CachedConfigMapGetter(client corev1client.ConfigMapsGetter, listers KubeInformersForNamespaces) corev1client.ConfigMapsGetter
- func CachedSecretGetter(client corev1client.SecretsGetter, listers KubeInformersForNamespaces) corev1client.SecretsGetter
- func EnsureFinalizer(ctx context.Context, client OperatorClientWithFinalizers, ...) error
- func FindCondition(conditions []metav1.Condition, conditionType string) *metav1.Condition
- func FindOperandVersion(versions []configv1.OperandVersion, name string) *configv1.OperandVersion
- func FindOperatorCondition(conditions []operatorv1.OperatorCondition, conditionType string) *operatorv1.OperatorCondition
- func FlagsFromUnstructured(unstructuredArgs map[string]interface{}) (map[string][]string, error)
- func InjectObservedProxyIntoContainers(podSpec *corev1.PodSpec, containerNames []string, observedConfig []byte, ...) error
- func InjectTrustedCAIntoContainers(podSpec *corev1.PodSpec, configMapName string, containerNames []string) error
- func IsConditionFalse(conditions []metav1.Condition, conditionType string) bool
- func IsConditionPresentAndEqual(conditions []metav1.Condition, conditionType string, ...) bool
- func IsConditionTrue(conditions []metav1.Condition, conditionType string) bool
- func IsOperatorConditionFalse(conditions []operatorv1.OperatorCondition, conditionType string) bool
- func IsOperatorConditionPresentAndEqual(conditions []operatorv1.OperatorCondition, conditionType string, ...) bool
- func IsOperatorConditionTrue(conditions []operatorv1.OperatorCondition, conditionType string) bool
- func MapToEnvVars(mapEnvVars map[string]string) []corev1.EnvVar
- func NewFakeNodeLister(client kubernetes.Interface) corev1listers.NodeLister
- func NewFakeSharedIndexInformer() cache.SharedIndexInformer
- func NewMultiLineAggregate(errList []error) error
- func RemoveCondition(conditions *[]metav1.Condition, conditionType string)
- func RemoveFinalizer(ctx context.Context, client OperatorClientWithFinalizers, ...) error
- func RemoveOperatorCondition(conditions *[]operatorv1.OperatorCondition, conditionType string)
- func SetCondition(conditions *[]metav1.Condition, newCondition metav1.Condition)
- func SetOperandVersion(versions *[]configv1.OperandVersion, operandVersion configv1.OperandVersion) string
- func SetOperatorCondition(conditions *[]operatorv1.OperatorCondition, ...)
- func ToFlagSlice(args map[string][]string) []string
- func UpdateSpec(ctx context.Context, client OperatorClient, ...) (*operatorv1.OperatorSpec, bool, error)
- func UpdateStaticPodStatus(ctx context.Context, client StaticPodOperatorClient, ...) (*operatorv1.StaticPodOperatorStatus, bool, error)
- func UpdateStatus(ctx context.Context, client OperatorClient, updateFuncs ...UpdateStatusFunc) (*operatorv1.OperatorStatus, bool, error)
- type KubeInformersForNamespaces
- type OperatorClient
- type OperatorClientWithFinalizers
- type StaticPodOperatorClient
- type UpdateOperatorSpecFunc
- type UpdateStaticPodStatusFunc
- type UpdateStatusFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CachedConfigMapGetter ¶
func CachedConfigMapGetter(client corev1client.ConfigMapsGetter, listers KubeInformersForNamespaces) corev1client.ConfigMapsGetter
func CachedSecretGetter ¶
func CachedSecretGetter(client corev1client.SecretsGetter, listers KubeInformersForNamespaces) corev1client.SecretsGetter
func EnsureFinalizer ¶
func EnsureFinalizer(ctx context.Context, client OperatorClientWithFinalizers, controllerName string) error
EnsureFinalizer adds a new finalizer to the operator CR, if it does not exists. No-op otherwise. The finalizer name is computed from the controller name and operator name ($OPERATOR_NAME or os.Args[0]) It re-tries on conflicts.
func FindCondition ¶
func FindOperandVersion ¶
func FindOperandVersion(versions []configv1.OperandVersion, name string) *configv1.OperandVersion
func FindOperatorCondition ¶
func FindOperatorCondition(conditions []operatorv1.OperatorCondition, conditionType string) *operatorv1.OperatorCondition
func FlagsFromUnstructured ¶
FlagsFromUnstructured process the unstructured arguments usually retrieved from an operator's configuration file under a specific key. There are only two supported/valid types for arguments, that is []sting and/or string. Passing a different type yield an error.
Use ToFlagSlice function to get a slice of string flags.
func InjectObservedProxyIntoContainers ¶
func InjectObservedProxyIntoContainers(podSpec *corev1.PodSpec, containerNames []string, observedConfig []byte, fields ...string) error
InjectObservedProxyIntoContainers injects proxy environment variables in containers specified in containerNames.
func IsConditionFalse ¶
func IsConditionTrue ¶
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 MapToEnvVars ¶
MapToEnvVars converts a string-string map to a slice of corev1.EnvVar-s
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 ¶
NewMultiLineAggregate returns an aggregate error with multi-line output
func RemoveCondition ¶
func RemoveFinalizer ¶
func RemoveFinalizer(ctx context.Context, client OperatorClientWithFinalizers, controllerName string) error
RemoveFinalizer removes a finalizer from the operator CR, if it is there. No-op otherwise. The finalizer name is computed from the controller name and operator name ($OPERATOR_NAME or os.Args[0]) It re-tries on conflicts.
func RemoveOperatorCondition ¶
func RemoveOperatorCondition(conditions *[]operatorv1.OperatorCondition, conditionType string)
func SetCondition ¶
func SetOperandVersion ¶
func SetOperandVersion(versions *[]configv1.OperandVersion, operandVersion configv1.OperandVersion) string
SetOperandVersion sets the new version and returns the previous value.
func SetOperatorCondition ¶
func SetOperatorCondition(conditions *[]operatorv1.OperatorCondition, newCondition operatorv1.OperatorCondition)
func ToFlagSlice ¶
ToFlagSlice transforms the provided arguments to a slice of string flags. A flag name is taken directly from the key and the value is simply attached. A flag is repeated iff it has more than one value.
func UpdateSpec ¶
func UpdateSpec(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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 // Used in by workloads controller and controllers that report deployment pods status PodLister() corev1listers.PodLister }
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 // GetObjectMeta return the operator metadata. GetObjectMeta() (meta *metav1.ObjectMeta, err error) // 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 version. UpdateOperatorSpec(ctx context.Context, oldResourceVersion string, in *operatorv1.OperatorSpec) (out *operatorv1.OperatorSpec, newResourceVersion string, err error) // UpdateOperatorStatus updates the status of the operator, assuming the given resource version. UpdateOperatorStatus(ctx context.Context, oldResourceVersion string, in *operatorv1.OperatorStatus) (out *operatorv1.OperatorStatus, err error) }
type OperatorClientWithFinalizers ¶
type OperatorClientWithFinalizers interface { OperatorClient // EnsureFinalizer adds a new finalizer to the operator CR, if it does not exists. No-op otherwise. EnsureFinalizer(ctx context.Context, finalizer string) error // RemoveFinalizer removes a finalizer from the operator CR, if it is there. No-op otherwise. RemoveFinalizer(ctx context.Context, finalizer string) error }
func NewFakeOperatorClient ¶
func NewFakeOperatorClient(spec *operatorv1.OperatorSpec, status *operatorv1.OperatorStatus, triggerErr func(rv string, status *operatorv1.OperatorStatus) error) OperatorClientWithFinalizers
NewFakeOperatorClient returns a fake operator client suitable to use in static pod controller unit tests.
func NewFakeOperatorClientWithObjectMeta ¶
func NewFakeOperatorClientWithObjectMeta(meta *metav1.ObjectMeta, spec *operatorv1.OperatorSpec, status *operatorv1.OperatorStatus, triggerErr func(rv string, status *operatorv1.OperatorStatus) error) OperatorClientWithFinalizers
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(ctx context.Context) (spec *operatorv1.StaticPodOperatorSpec, status *operatorv1.StaticPodOperatorStatus, resourceVersion string, err error) // UpdateStaticPodOperatorStatus updates the status, assuming the given resource version. UpdateStaticPodOperatorStatus(ctx context.Context, resourceVersion string, in *operatorv1.StaticPodOperatorStatus) (out *operatorv1.StaticPodOperatorStatus, err error) // UpdateStaticPodOperatorSpec updates the spec, assuming the given resource version. UpdateStaticPodOperatorSpec(ctx context.Context, resourceVersion string, in *operatorv1.StaticPodOperatorSpec) (out *operatorv1.StaticPodOperatorSpec, newResourceVersion string, err error) }
func NewFakeStaticPodOperatorClient ¶
func NewFakeStaticPodOperatorClient( staticPodSpec *operatorv1.StaticPodOperatorSpec, staticPodStatus *operatorv1.StaticPodOperatorStatus, triggerStatusErr func(rv string, status *operatorv1.StaticPodOperatorStatus) error, triggerSpecErr func(rv string, spec *operatorv1.StaticPodOperatorSpec) 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.