labeller

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: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdentityCatalogOperator = "catalog-operator"
	IdentityOLMOperator     = "olm-operator"
)

Variables

This section is empty.

Functions

func ContentHashFilter

func ContentHashFilter(object metav1.Object) bool

func ContentHashLabeler

func ContentHashLabeler[T metav1.Object, A ApplyConfig[A]](
	ctx context.Context,
	logger *logrus.Logger,
	check func(metav1.Object) bool,
	hasher func(object T) (string, error),
	list func(options labels.Selector) ([]T, error),
	applyConfigFor func(name, namespace string) A,
	apply func(namespace string, ctx context.Context, cfg A, opts metav1.ApplyOptions) (T, error),
) func(done func() bool) queueinformer.LegacySyncHandler

func Filter

func Filter(gvr schema.GroupVersionResource) func(metav1.Object) bool

func HasOLMLabel

func HasOLMLabel(object metav1.Object) bool

func HasOLMOwnerRef

func HasOLMOwnerRef(object metav1.Object) bool

HasOLMOwnerRef determines if an object is owned by another object in the OLM Groups. This checks both classical OwnerRefs and the "OLM OwnerRef" in labels to handle cluster-scoped resources.

func JobFilter

func JobFilter(getConfigMap func(namespace, name string) (metav1.Object, error)) func(object metav1.Object) bool

func ObjectLabeler

func ObjectLabeler[T metav1.Object, A ApplyConfig[A]](
	ctx context.Context,
	logger *logrus.Logger,
	check func(metav1.Object) bool,
	list func(options labels.Selector) ([]T, error),
	applyConfigFor func(name, namespace string) A,
	apply func(namespace string, ctx context.Context, cfg A, opts metav1.ApplyOptions) (T, error),
) func(done func() bool) queueinformer.LegacySyncHandler

func ObjectPatchLabeler

func ObjectPatchLabeler(
	ctx context.Context,
	logger *logrus.Logger,
	check func(metav1.Object) bool,
	list func(selector labels.Selector) (ret []*metav1.PartialObjectMetadata, err error),
	patch func(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1.CustomResourceDefinition, err error),
) func(done func() bool) queueinformer.LegacySyncHandler

CRDs did not have applyconfigurations generated for them on accident, we can remove this when https://github.com/kubernetes/kubernetes/pull/120177 lands

func ServiceAccountFilter

func ServiceAccountFilter(isServiceAccountReferenced func(namespace, name string) bool) func(object metav1.Object) bool

func Validate

func Validate(ctx context.Context, logger *logrus.Logger, metadataClient metadata.Interface, operatorClient operators.Interface, identity Identity) (bool, error)

Types

type ApplyConfig

type ApplyConfig[T any] interface {
	WithLabels(map[string]string) T
}

type Client

type Client[A ApplyConfig[A], T metav1.Object] interface {
	Apply(ctx context.Context, cfg ApplyConfig[A], opts metav1.ApplyOptions) (result T, err error)
}

type Identity added in v0.27.0

type Identity string

Jump to

Keyboard shortcuts

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