meta

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MutationTypeMerge   = "merge"
	MutationTypeReplace = "replace"
)

Variables

View Source
var Labels = map[string]string{"app": "crane2"}

Functions

func ValidateLabels

func ValidateLabels(labels map[string]string) (err error)

Types

type ContainerMutation

type ContainerMutation interface {
	Mutation
	// Name returns a name for the container
	Name() *string
	// SecurityContext returns mutated security context for the target container
	SecurityContext() *corev1.SecurityContext
	// Resources returns mutated resources on the container
	Resources() *corev1.ResourceRequirements
}

func NewContainerMutation

func NewContainerMutation(spec *corev1.Container, typ MutationType) ContainerMutation

type Mutation

type Mutation interface {
	Type() MutationType
}

Mutation allows mutating state transfer resources on the fly based on the type

type MutationType

type MutationType string

type NamespacedNamePair

type NamespacedNamePair interface {
	// Source represents source namespace and name
	Source() types.NamespacedName
	// Destination represents destination namespace and name
	Destination() types.NamespacedName
}

NamespacedNamePair knows how to map a source and a destination namespace involved in state transfer

type ObjectMetaMutation

type ObjectMetaMutation interface {
	Mutation
	// Labels returns a set of labels for the target ObjectMeta
	Labels() map[string]string
	// Annotations returns a set of annotations for the target ObjectMeta
	Annotations() map[string]string
	// Name returns a name for the target ObjectMeta
	Name() *string
	// OwnerReferences returns a list of OwnerReferences
	OwnerReferences() []metav1.OwnerReference
}

ObjectMetaMutation knows how to mutate fields of a metav1.ObjectMeta resource

func NewObjectMetaMutation

func NewObjectMetaMutation(objectMeta *metav1.ObjectMeta, typ MutationType) ObjectMetaMutation

type PodSpecMutation

type PodSpecMutation interface {
	Mutation
	// SecurityContext returns a PodSecurityContext for the target Pod
	PodSecurityContext() *corev1.PodSecurityContext
	// NodeSelector returns a node selector for the target Pod
	NodeSelector() map[string]string
	// NodeName returns a node name for the target Pod
	NodeName() *string
}

PodSpecMutation knows how to mutate PodSpec fields of a corev1.Pod resource

func NewPodSpecMutation

func NewPodSpecMutation(spec *corev1.PodSpec, typ MutationType) PodSpecMutation

Jump to

Keyboard shortcuts

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