kmeta

package
v0.0.0-...-20d7626 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

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.

Types

type Accessor

type Accessor interface {
	// Interfaces for metav1.TypeMeta
	GroupVersionKind() schema.GroupVersionKind
	SetGroupVersionKind(gvk schema.GroupVersionKind)

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

	// Interfaces for metav1.Object
	GetNamespace() string
	SetNamespace(namespace string)
	GetName() string
	SetName(name string)
	GetGenerateName() string
	SetGenerateName(name string)
	GetUID() types.UID
	SetUID(uid types.UID)
	GetResourceVersion() string
	SetResourceVersion(version string)
	GetGeneration() int64
	SetGeneration(generation int64)
	GetSelfLink() string
	SetSelfLink(selfLink string)
	GetCreationTimestamp() metav1.Time
	SetCreationTimestamp(timestamp metav1.Time)
	GetDeletionTimestamp() *metav1.Time
	SetDeletionTimestamp(timestamp *metav1.Time)
	GetDeletionGracePeriodSeconds() *int64
	SetDeletionGracePeriodSeconds(*int64)
	GetLabels() map[string]string
	SetLabels(labels map[string]string)
	GetAnnotations() map[string]string
	SetAnnotations(annotations map[string]string)
	GetInitializers() *metav1.Initializers
	SetInitializers(initializers *metav1.Initializers)
	GetFinalizers() []string
	SetFinalizers(finalizers []string)
	GetOwnerReferences() []metav1.OwnerReference
	SetOwnerReferences([]metav1.OwnerReference)
	GetClusterName() string
	SetClusterName(clusterName string)
}

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 inidcates 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