annotations

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package annotations holds the logic for examining and extracting information from annotations. This includes functionality such as:

  • Namespace parsing and fetching
  • Ownerhship considerations
  • And the general constant strings for annotations

Index

Constants

View Source
const (
	// Prefix is the prefix for annotations
	Prefix = "reflector.havulv.io"
	// ReflectAnnotation is the annotation used to determine if
	// the secret should be reflected or not
	ReflectAnnotation = Prefix + "/reflect"

	// NamespaceAnnotation is the annotation which determines which
	// namespaces to reflect to
	NamespaceAnnotation = Prefix + "/namespaces"

	// ReflectedFromAnnotation indicates what the originating namespace of the secret was
	ReflectedFromAnnotation = Prefix + "/reflected-from"
	// ReflectedAtAnnotation indicates when the annotation was originally reflected
	ReflectedAtAnnotation = Prefix + "/reflected-at"
	// ReflectionHashAnnotation is a hash of the reflected secret for quick comparison
	ReflectionHashAnnotation = Prefix + "/hash"
	// ReflectionOwnerAnnotation denotes that the reflected secret is owned by the reflector
	// and can be created or deleted at will or that it is owned by some other entity
	ReflectionOwnerAnnotation = Prefix + "/owner"
	// ReflectionOwned is the key to determine if a secret is owned by any reflector
	ReflectionOwned = "reflector"
)

Variables

View Source
var (
	// ErrorNoNamespace is used when no namespaces are supplied
	ErrorNoNamespace = errors.New("no namespace given")
)

Functions

func CanOperate

func CanOperate(annotations map[string]string) bool

CanOperate checks if an operation can be performed on an existing secret

func ParseOrFetchNamespaces

func ParseOrFetchNamespaces(
	ctx context.Context,
	client corev1.NamespacesGetter,
	objAnnotations map[string]string,
) ([]string, error)

ParseOrFetchNamespaces parses the namespaces of a secret from the specified annotation and retrives either all namespaces (if `*` is in the field of the annotation) or the specified namespaces. An empty annotation yields no namespaces.

Types

This section is empty.

Jump to

Keyboard shortcuts

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