common

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func ApplyUpdate

func ApplyUpdate(orig, update *unstructured.Unstructured) (*unstructured.Unstructured, error)

func MakeControllerRef

func MakeControllerRef(parent *unstructured.Unstructured) *metav1.OwnerReference

func ManageChildren

func ManageChildren(dynClient *dynamicclientset.Clientset, updateStrategy ChildUpdateStrategy, parent *unstructured.Unstructured, observedChildren, desiredChildren ChildMap) error

func ParseAPIVersion

func ParseAPIVersion(apiVersion string) (group, version string)

func ParseChildMapKey

func ParseChildMapKey(key string) (apiVersion, kind string)

Types

type ChildMap

type ChildMap map[string]map[string]*unstructured.Unstructured

func MakeChildMap

func MakeChildMap(parent metav1.Object, list []*unstructured.Unstructured) ChildMap

MakeChildMap builds the map of children resources that is suitable for use in the `children` field of a CompositeController SyncRequest or `attachments` field of the DecoratorControllers SyncRequest.

This function returns a ChildMap which is a map of maps. The outer most map is keyed using the child's type and the inner map is keyed using the child's name. If the parent resource is clustered and the child resource is namespaced the inner map's keys are prefixed by the namespace of the child resource.

This function requires parent resources has the meta.Namespace accurately set. If the namespace of the pareent is empty it's considered a clustered resource.

If a user returns a namespaced as a child of a clustered resources without the namespace set this is considered a user error but it's not handled here since the api errorstrying to create the child is clear.

func (ChildMap) FindGroupKindName

func (m ChildMap) FindGroupKindName(apiGroup, kind, name string) *unstructured.Unstructured

func (ChildMap) InitGroup

func (m ChildMap) InitGroup(apiVersion, kind string)

func (ChildMap) Insert

func (m ChildMap) Insert(parent metav1.Object, obj *unstructured.Unstructured)

func (ChildMap) List added in v0.4.0

func (m ChildMap) List() []*unstructured.Unstructured

List expands the ChildMap into a flat list of child objects, in random order.

func (ChildMap) ReplaceChild

func (m ChildMap) ReplaceChild(parent metav1.Object, child *unstructured.Unstructured)

ReplaceChild replaces the child object with the same name & namespace as the given child with the contents of the given child. If no child exists in the existing map then no action is taken.

type ChildUpdateStrategy

type ChildUpdateStrategy interface {
	GetMethod(apiGroup, kind string) v1alpha1.ChildUpdateMethod
}

type GroupKindMap

type GroupKindMap map[string]*dynamicdiscovery.APIResource

func (GroupKindMap) Get

func (m GroupKindMap) Get(apiGroup, kind string) *dynamicdiscovery.APIResource

func (GroupKindMap) Set

func (m GroupKindMap) Set(apiGroup, kind string, resource *dynamicdiscovery.APIResource)

type InformerMap

type InformerMap map[string]*dynamicinformer.ResourceInformer

func (InformerMap) Get

func (m InformerMap) Get(apiVersion, resource string) *dynamicinformer.ResourceInformer

func (InformerMap) Set

func (m InformerMap) Set(apiVersion, resource string, informer *dynamicinformer.ResourceInformer)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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