imagereferencemutators

package
v0.0.0-...-60118cf Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldErrorOrInternal

func FieldErrorOrInternal(err error, path *field.Path) *field.Error

func GetPodSpec

func GetPodSpec(obj runtime.Object) (*core.PodSpec, *field.Path, error)

GetPodSpec returns a mutable pod spec out of the provided object, including a field path to the field in the object, or an error if the object does not contain a pod spec. This only returns internal objects.

func GetPodSpecV1

func GetPodSpecV1(obj runtime.Object) (*corev1.PodSpec, *field.Path, error)

GetPodSpecV1 returns a mutable pod spec out of the provided object, including a field path to the field in the object, or an error if the object does not contain a pod spec. This only returns pod specs for v1 compatible objects.

func GetTemplateMetaObject

func GetTemplateMetaObject(obj runtime.Object) (metav1.Object, bool)

GetTemplateMetaObject returns a mutable metav1.Object interface for the template the object contains, or false if no such object is available.

func NewPodSpecMutator

func NewPodSpecMutator(spec *core.PodSpec, oldSpec *core.PodSpec, path *field.Path, resolveAnnotationChanged bool) *podSpecMutator

func NewPodSpecV1Mutator

func NewPodSpecV1Mutator(spec *corev1.PodSpec, oldSpec *corev1.PodSpec, path *field.Path, resolveAnnotationChanged bool) *podSpecV1Mutator

func ResolveAllNames

func ResolveAllNames(annotations AnnotationAccessor) bool

Types

type AnnotationAccessor

type AnnotationAccessor interface {
	// Annotations returns a map representing annotations. Not mutable.
	Annotations() map[string]string
	// SetAnnotations sets representing annotations onto the object.
	SetAnnotations(map[string]string)
	// TemplateAnnotations returns a map representing annotations on a nested template in the object. Not mutable.
	// If no template is present bool will be false.
	TemplateAnnotations() (map[string]string, bool)
	// SetTemplateAnnotations sets annotations on a nested template in the object.
	// If no template is present bool will be false.
	SetTemplateAnnotations(map[string]string) bool
}

type ContainerMutator

type ContainerMutator interface {
	GetName() string
	GetImage() string
	SetImage(image string)
}

type ImageMutators

type ImageMutators interface {
	GetImageReferenceMutator(obj, old runtime.Object) (ImageReferenceMutator, error)
	GetAnnotationAccessor(obj runtime.Object) (AnnotationAccessor, bool)
}

type ImageReferenceMutateFunc

type ImageReferenceMutateFunc func(ref *kapi.ObjectReference) error

ImageReferenceMutateFunc is passed a reference representing an image, and may alter the Name, Kind, and Namespace fields of the reference. If an error is returned the object may still be mutated under the covers.

type ImageReferenceMutator

type ImageReferenceMutator interface {
	// Mutate invokes fn on every image reference in the object. If fn returns an error,
	// a field.Error is added to the list to be returned. Mutate does not terminate early
	// if errors are detected.
	Mutate(fn ImageReferenceMutateFunc) field.ErrorList
}

type KubeImageMutators

type KubeImageMutators struct{}

func (KubeImageMutators) GetAnnotationAccessor

func (KubeImageMutators) GetAnnotationAccessor(obj runtime.Object) (AnnotationAccessor, bool)

GetAnnotationAccessor returns an accessor for the provided object or false if the object does not support accessing annotations.

func (KubeImageMutators) GetImageReferenceMutator

func (m KubeImageMutators) GetImageReferenceMutator(obj, old runtime.Object) (ImageReferenceMutator, error)

GetImageReferenceMutator returns a mutator for the provided object, or an error if no such mutator is defined. Only references that are different between obj and old will be returned unless old is nil.

type PodSpecReferenceMutator

type PodSpecReferenceMutator interface {
	GetContainerByIndex(init bool, i int) (ContainerMutator, bool)
	GetContainerByName(name string) (ContainerMutator, bool)
	GetPath() *field.Path
}

Jump to

Keyboard shortcuts

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