kmeta

package
v0.0.0-...-2cb4bbe Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package kmeta provides Knative utilities for operating on Kubernetes resources' ObjectMeta.

Index

Constants

This section is empty.

Variables

View Source
var CopyMap = kmap.Copy

CopyMap makes a copy of the map. Deprecated: use kmap.Copy

View Source
var FilterMap = kmap.Filter

FilterMap creates a copy of the provided map, filtering out the elements that match `filter`. nil `filter` is accepted. Deprecated: use kmap.Filter

View Source
var UnionMaps = kmap.Union

UnionMaps returns a map constructed from the union of input maps. where values from latter maps win. Deprecated: use kmap.Union

Functions

func ChildName

func ChildName(parent, suffix string) string

ChildName generates a name for the resource based upon the parent resource and suffix. If the concatenated name is longer than K8s permits the name is hashed and truncated to permit construction of the resource, but still keeps it unique. If the suffix itself is longer than 31 characters, then the whole string will be hashed and `parent|hash|suffix` will be returned, where parent and suffix will be trimmed to fit (prefix of parent at most of length 31, and prefix of suffix at most length 30).

func MakeGenerationLabelSelector

func MakeGenerationLabelSelector(om metav1.ObjectMetaAccessor) labels.Selector

MakeGenerationLabelSelector constructs a selector for subresources instantiated at this version of the parent resource. This keys off of the labels populated by MakeGenerationLabels.

func MakeGenerationLabels

func MakeGenerationLabels(om metav1.ObjectMetaAccessor) labels.Set

MakeGenerationLabels constructs a set of labels to apply to subresources instantiated at this version of the parent resource, so that we can efficiently select them.

func MakeOldGenerationLabelSelector

func MakeOldGenerationLabelSelector(om metav1.ObjectMetaAccessor) labels.Selector

MakeOldGenerationLabelSelector constructs a selector for subresources instantiated at an older version of the parent resource. This keys off of the labels populated by MakeGenerationLabels.

func MakeOldVersionLabelSelector

func MakeOldVersionLabelSelector(om metav1.ObjectMetaAccessor) labels.Selector

MakeOldVersionLabelSelector constructs a selector for subresources instantiated at an older version of the parent resource. This keys off of the labels populated by MakeVersionLabels.

func MakeVersionLabelSelector

func MakeVersionLabelSelector(om metav1.ObjectMetaAccessor) labels.Selector

MakeVersionLabelSelector constructs a selector for subresources instantiated at this version of the parent resource. This keys off of the labels populated by MakeVersionLabels.

func MakeVersionLabels

func MakeVersionLabels(om metav1.ObjectMetaAccessor) labels.Set

MakeVersionLabels constructs a set of labels to apply to subresources instantiated at this version of the parent resource, so that we can efficiently select them.

func NewControllerRef

func NewControllerRef(obj OwnerRefable) *metav1.OwnerReference

NewControllerRef creates an OwnerReference pointing to the given controller.

func ObjectReference

func ObjectReference(obj Accessor) corev1.ObjectReference

ObjectReference returns an core/v1.ObjectReference for the given object

Types

type Accessor

type Accessor interface {
	metav1.Object

	// Interfaces for metav1.TypeMeta
	GroupVersionKind() schema.GroupVersionKind
	SetGroupVersionKind(gvk schema.GroupVersionKind)

	// Interfaces for runtime.Object
	GetObjectKind() schema.ObjectKind
	DeepCopyObject() runtime.Object
}

Accessor is a collection of interfaces from metav1.TypeMeta, runtime.Object and metav1.Object that Kubernetes API types registered with runtime.Scheme must support.

func DeletionHandlingAccessor

func DeletionHandlingAccessor(obj interface{}) (Accessor, error)

DeletionHandlingAccessor tries to convert given interface into Accessor first; and to handle deletion, it try to fetch info from DeletedFinalStateUnknown on failure. The name is a reference to cache.DeletionHandlingMetaNamespaceKeyFunc

type OwnerRefable

type OwnerRefable interface {
	metav1.ObjectMetaAccessor

	// GetGroupVersionKind returns a GroupVersionKind. The name is chosen
	// to avoid collision with TypeMeta's GroupVersionKind() method.
	// See: https://issues.k8s.io/3030
	GetGroupVersionKind() schema.GroupVersionKind
}

OwnerRefable indicates that a particular type has sufficient information to produce a metav1.OwnerReference to an object.

type OwnerRefableAccessor

type OwnerRefableAccessor interface {
	OwnerRefable
	Accessor
}

OwnerRefableAccessor is a combination of OwnerRefable interface and Accessor interface which indicates that it has 1) sufficient information to produce a metav1.OwnerReference to an object, 2) and a collection of interfaces from metav1.TypeMeta runtime.Object and metav1.Object that Kubernetes API types registered with runtime.Scheme must support.

Jump to

Keyboard shortcuts

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