Documentation ¶
Index ¶
- func CachedConfigMapGetter(client corev1client.ConfigMapsGetter, listers KubeInformersForNamespaces) corev1client.ConfigMapsGetter
- func CachedSecretGetter(client corev1client.SecretsGetter, listers KubeInformersForNamespaces) corev1client.SecretsGetter
- func CanonicalizeOperatorStatus(obj *applyoperatorv1.OperatorStatusApplyConfiguration)
- func CanonicalizeStaticPodOperatorStatus(obj *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration)
- func CompareGenerationStatusByKeys(a, b applyoperatorv1.GenerationStatusApplyConfiguration) int
- func CompareNodeStatusByNode(a, b applyoperatorv1.NodeStatusApplyConfiguration) int
- func CompareOperatorConditionByType(a, b applyoperatorv1.OperatorConditionApplyConfiguration) int
- func EnsureFinalizer(ctx context.Context, client OperatorClientWithFinalizers, ...) error
- func FindApplyCondition(haystack []applyoperatorv1.OperatorConditionApplyConfiguration, ...) *applyoperatorv1.OperatorConditionApplyConfiguration
- 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 NewFakeOperatorClient(spec *operatorv1.OperatorSpec, status *operatorv1.OperatorStatus, ...) *fakeOperatorClient
- func NewFakeOperatorClientWithObjectMeta(meta *metav1.ObjectMeta, spec *operatorv1.OperatorSpec, ...) *fakeOperatorClient
- func NewFakeSharedIndexInformer() cache.SharedIndexInformer
- func NewFakeStaticPodOperatorClient(staticPodSpec *operatorv1.StaticPodOperatorSpec, ...) *fakeStaticPodOperatorClient
- 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 SetApplyConditionsLastTransitionTime(clock clock.PassiveClock, ...)
- 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 ToStaticPodOperator(in *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration) (*operatorv1.StaticPodOperatorStatus, error)
- 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 Foo
- type KubeInformersForNamespaces
- type OperatorClient
- type OperatorClientWithFinalizers
- type OperatorSpecExtractor
- type OperatorStatusExtractor
- 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 CanonicalizeOperatorStatus ¶
func CanonicalizeOperatorStatus(obj *applyoperatorv1.OperatorStatusApplyConfiguration)
func CanonicalizeStaticPodOperatorStatus ¶
func CanonicalizeStaticPodOperatorStatus(obj *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration)
func CompareGenerationStatusByKeys ¶
func CompareGenerationStatusByKeys(a, b applyoperatorv1.GenerationStatusApplyConfiguration) int
func CompareNodeStatusByNode ¶
func CompareNodeStatusByNode(a, b applyoperatorv1.NodeStatusApplyConfiguration) int
func CompareOperatorConditionByType ¶
func CompareOperatorConditionByType(a, b applyoperatorv1.OperatorConditionApplyConfiguration) int
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 FindApplyCondition ¶
func FindApplyCondition(haystack []applyoperatorv1.OperatorConditionApplyConfiguration, conditionType *string) *applyoperatorv1.OperatorConditionApplyConfiguration
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 NewFakeOperatorClient ¶
func NewFakeOperatorClient(spec *operatorv1.OperatorSpec, status *operatorv1.OperatorStatus, triggerErr func(rv string, status *operatorv1.OperatorStatus) error) *fakeOperatorClient
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) *fakeOperatorClient
func NewFakeSharedIndexInformer ¶
func NewFakeSharedIndexInformer() cache.SharedIndexInformer
NewFakeSharedIndexInformer returns a fake shared index informer, suitable to use in static pod controller unit tests.
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) *fakeStaticPodOperatorClient
NewFakeStaticPodOperatorClient returns a fake operator client 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 SetApplyConditionsLastTransitionTime ¶
func SetApplyConditionsLastTransitionTime(clock clock.PassiveClock, newConditions *[]applyoperatorv1.OperatorConditionApplyConfiguration, oldConditions []applyoperatorv1.OperatorConditionApplyConfiguration)
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 ToStaticPodOperator ¶
func ToStaticPodOperator(in *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration) (*operatorv1.StaticPodOperatorStatus, error)
ToStaticPodOperator returns the equivalent typed kind for the applyconfiguration. Due to differences in serialization like omitempty on strings versus pointers, the returned values can be slightly different. This is an expensive way to diff the result, but it is an effective one.
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 Foo ¶
type Foo interface { ExtractOperatorSpec(fieldManager string) (*applyoperatorv1.OperatorSpecApplyConfiguration, error) ExtractOperatorStatus(fieldManager string) (*applyoperatorv1.OperatorStatusApplyConfiguration, error) }
type KubeInformersForNamespaces ¶
type KubeInformersForNamespaces interface { Start(stopCh <-chan struct{}) InformersFor(namespace string) informers.SharedInformerFactory Namespaces() sets.Set[string] // WaitForCacheSync blocks until all started informers' caches were synced // or the stop channel gets closed. WaitForCacheSync(stopCh <-chan struct{}) map[string]map[reflect.Type]bool 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) // GetOperatorStateWithQuorum return the operator spec, status and resource version directly from a server read. GetOperatorStateWithQuorum(ctx context.Context) (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) ApplyOperatorSpec(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.OperatorSpecApplyConfiguration) (err error) ApplyOperatorStatus(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.OperatorStatusApplyConfiguration) (err error) PatchOperatorStatus(ctx context.Context, jsonPatch *jsonpatch.PatchSet) (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 }
type OperatorSpecExtractor ¶
type OperatorSpecExtractor func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.OperatorSpecApplyConfiguration, error)
type OperatorStatusExtractor ¶
type OperatorStatusExtractor func(obj *unstructured.Unstructured, fieldManager string) (*applyoperatorv1.OperatorStatusApplyConfiguration, error)
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) ApplyStaticPodOperatorSpec(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.StaticPodOperatorSpecApplyConfiguration) (err error) ApplyStaticPodOperatorStatus(ctx context.Context, fieldManager string, applyConfiguration *applyoperatorv1.StaticPodOperatorStatusApplyConfiguration) (err error) PatchStaticOperatorStatus(ctx context.Context, jsonPatch *jsonpatch.PatchSet) (err error) }
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
UpdateObservedConfigFn returns a func to update the config.
type UpdateStaticPodStatusFunc ¶
type UpdateStaticPodStatusFunc func(status *operatorv1.StaticPodOperatorStatus) error
UpdateStaticPodStatusFunc 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
UpdateConditionFn returns a func to update a condition.