resources

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.0, MIT Imports: 33 Imported by: 65

Documentation

Index

Constants

View Source
const ATTR_EVENTSOURCE = "event-source"

Variables

This section is empty.

Functions

func AddLabel added in v0.2.0

func AddLabel(labels map[string]string, key, value string) map[string]string

func AddOwner

func AddOwner(data ObjectData, clusterid string, obj Object) bool

func CreateOrModify

func CreateOrModify(obj Object, f func(*ModificationState) error) (bool, error)

func DeclareDefaultVersion

func DeclareDefaultVersion(gv schema.GroupVersion)

func DefaultScheme

func DefaultScheme() *runtime.Scheme

func DefaultVersion

func DefaultVersion(g string) string

func EqualsClusterObjectKey added in v0.2.0

func EqualsClusterObjectKey(a, b ClusterObjectKey) bool

func EqualsObjectKey added in v0.2.0

func EqualsObjectKey(a, b ObjectKey) bool

func EqualsObjectName added in v0.2.0

func EqualsObjectName(a, b ObjectName) bool

func FilterObjectDeletionError added in v0.2.0

func FilterObjectDeletionError(args ...interface{}) error

func GetAnnotatedOwners

func GetAnnotatedOwners(data ObjectData) []string

func GetAnnotation

func GetAnnotation(o ObjectData, key string) (string, bool)

func GetLabel

func GetLabel(o ObjectData, key string) (string, bool)

func GetObjectSpec added in v0.2.0

func GetObjectSpec(o ObjectData) (interface{}, bool)

func GetObjectStatus added in v0.2.0

func GetObjectStatus(o ObjectData) (interface{}, bool)

func GetSecretPropertiesFrom

func GetSecretPropertiesFrom(secret *api.Secret) utils.Properties

func IsObjectDeletionError added in v0.2.0

func IsObjectDeletionError(err error) bool

func Modify

func Modify(obj Object, f func(*ModificationState) error) (bool, error)

func ModifyStatus added in v0.2.0

func ModifyStatus(obj Object, f func(*ModificationState) error) (bool, error)

func NewAbstractResource

func NewAbstractResource(ctx ResourceContext, self Internal, otype, ltype reflect.Type, gvk schema.GroupVersionKind) (AbstractResource, *ResourceHelper)

func NewCodec added in v0.2.0

func NewCodec(
	encoder runtime.Encoder,
	decoder runtime.Decoder,
	convertor runtime.ObjectConvertor,
	creater runtime.ObjectCreater,
	typer runtime.ObjectTyper,
	defaulter runtime.ObjectDefaulter,
	encodeVersion runtime.GroupVersioner,
	decodeVersion runtime.GroupVersioner,
	originalSchemeName string,
) runtime.Codec

NewCodec takes objects in their internal versions and converts them to external versions before serializing them. It assumes the serializer provided to it only deals with external versions. This class is also a serializer, but is generally used with a specific version.

func NewDefaultingCodecForScheme added in v0.2.0

func NewDefaultingCodecForScheme(

	scheme *runtime.Scheme,
	encoder runtime.Encoder,
	decoder runtime.Decoder,
	encodeVersion runtime.GroupVersioner,
	decodeVersion runtime.GroupVersioner,
) runtime.Codec

NewDefaultingCodecForScheme is a convenience method for callers that are using a scheme.

func NewGroupKind

func NewGroupKind(group, kind string) schema.GroupKind

func NewObjectName

func NewObjectName(names ...string) abstract.GenericObjectName

func NewWatchWrapper

func NewWatchWrapper(ctx context.Context, orig watch.Interface) watch.Interface

func ObjectArrayToString

func ObjectArrayToString(objs ...Object) string

func ParseObjectName

func ParseObjectName(name string) (abstract.GenericObjectName, error)

func Register

func Register(builders ...runtime.SchemeBuilder)

func RemoveAnnotation

func RemoveAnnotation(o ObjectData, key string) bool

func RemoveLabel

func RemoveLabel(o ObjectData, key string) bool

func RemoveOwnerReference

func RemoveOwnerReference(o ObjectData, ref *metav1.OwnerReference) bool

func SetAnnotation

func SetAnnotation(o ObjectData, key, value string) bool

func SetLabel

func SetLabel(o ObjectData, key, value string) bool

func SetObjectSpec added in v0.2.0

func SetObjectSpec(obj ObjectData, value interface{}) error

func SetOwnerReference

func SetOwnerReference(o ObjectData, ref *metav1.OwnerReference) bool

func UniversalDecoder added in v0.2.0

func UniversalDecoder(scheme *runtime.Scheme, decoder runtime.Decoder, versions ...schema.GroupVersion) runtime.Decoder

Types

type AbstractObject

type AbstractObject struct {
	*abstract.AbstractObject
	// contains filtered or unexported fields
}

func NewAbstractObject

func NewAbstractObject(self I_Object, data ObjectData, r Interface) AbstractObject

func (*AbstractObject) AddOwner

func (this *AbstractObject) AddOwner(obj Object) bool

func (*AbstractObject) AnnotatedEventf

func (this *AbstractObject) AnnotatedEventf(annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{})

func (*AbstractObject) ClusterKey

func (this *AbstractObject) ClusterKey() ClusterObjectKey

func (*AbstractObject) Create

func (this *AbstractObject) Create() error

func (*AbstractObject) CreateOrModify

func (this *AbstractObject) CreateOrModify(modifier Modifier) (bool, error)

func (*AbstractObject) CreateOrUpdate

func (this *AbstractObject) CreateOrUpdate() error

func (*AbstractObject) Delete

func (this *AbstractObject) Delete() error

func (*AbstractObject) Description

func (this *AbstractObject) Description() string

func (*AbstractObject) Event

func (this *AbstractObject) Event(eventtype, reason, message string)

func (*AbstractObject) Eventf

func (this *AbstractObject) Eventf(eventtype, reason, messageFmt string, args ...interface{})

func (*AbstractObject) GetCluster added in v0.2.0

func (this *AbstractObject) GetCluster() Cluster

func (*AbstractObject) GetLabel added in v0.2.0

func (this *AbstractObject) GetLabel(name string) string

func (*AbstractObject) GetOwnerReference

func (this *AbstractObject) GetOwnerReference() *metav1.OwnerReference

func (*AbstractObject) GetOwners

func (this *AbstractObject) GetOwners(kinds ...schema.GroupKind) ClusterObjectKeySet

func (*AbstractObject) GetResource added in v0.2.0

func (this *AbstractObject) GetResource() Interface

func (*AbstractObject) IsCoLocatedTo

func (this *AbstractObject) IsCoLocatedTo(o Object) bool

func (*AbstractObject) IsDeleting

func (this *AbstractObject) IsDeleting() bool

func (*AbstractObject) Modify

func (this *AbstractObject) Modify(modifier Modifier) (bool, error)

func (*AbstractObject) ModifyStatus

func (this *AbstractObject) ModifyStatus(modifier Modifier) (bool, error)

func (*AbstractObject) PastEventf

func (this *AbstractObject) PastEventf(timestamp metav1.Time, eventtype, reason, messageFmt string, args ...interface{})

func (*AbstractObject) RemoveOwner

func (this *AbstractObject) RemoveOwner(obj Object) bool

func (*AbstractObject) Resources

func (this *AbstractObject) Resources() Resources

func (*AbstractObject) Update

func (this *AbstractObject) Update() error

func (*AbstractObject) UpdateFromCache

func (this *AbstractObject) UpdateFromCache() error

func (*AbstractObject) UpdateStatus

func (this *AbstractObject) UpdateStatus() error

type AbstractResource

type AbstractResource struct {
	*abstract.AbstractResource
	// contains filtered or unexported fields
}

func (*AbstractResource) Create

func (this *AbstractResource) Create(obj ObjectData) (Object, error)

func (*AbstractResource) CreateOrModifyByName added in v0.2.0

func (this *AbstractResource) CreateOrModifyByName(obj ObjectDataName, modifier Modifier) (Object, bool, error)

func (*AbstractResource) CreateOrUpdate

func (this *AbstractResource) CreateOrUpdate(obj ObjectData) (Object, error)

func (*AbstractResource) Delete

func (this *AbstractResource) Delete(obj ObjectData) error

func (*AbstractResource) DeleteByName

func (this *AbstractResource) DeleteByName(obj ObjectDataName) error

func (*AbstractResource) Get added in v0.2.0

func (this *AbstractResource) Get(obj interface{}) (Object, error)

func (*AbstractResource) GetInto

func (this *AbstractResource) GetInto(name ObjectName, obj ObjectData) (Object, error)

func (*AbstractResource) Get_

func (this *AbstractResource) Get_(obj interface{}) (Object, error)

func (*AbstractResource) List

func (this *AbstractResource) List(opts metav1.ListOptions) (ret []Object, err error)

func (*AbstractResource) Modify

func (this *AbstractResource) Modify(obj ObjectData, modifier Modifier) (ObjectData, bool, error)

func (*AbstractResource) ModifyByName

func (this *AbstractResource) ModifyByName(obj ObjectDataName, modifier Modifier) (Object, bool, error)

func (*AbstractResource) ModifyStatus

func (this *AbstractResource) ModifyStatus(obj ObjectData, modifier Modifier) (ObjectData, bool, error)

func (*AbstractResource) ModifyStatusByName

func (this *AbstractResource) ModifyStatusByName(obj ObjectDataName, modifier Modifier) (Object, bool, error)

func (*AbstractResource) Name

func (this *AbstractResource) Name() string

func (*AbstractResource) Namespace

func (this *AbstractResource) Namespace(namespace string) Namespaced

func (*AbstractResource) Namespaced

func (this *AbstractResource) Namespaced() bool

func (*AbstractResource) New

func (this *AbstractResource) New(name ObjectName) Object

func (*AbstractResource) Update

func (this *AbstractResource) Update(obj ObjectData) (Object, error)

func (*AbstractResource) Wrap

func (this *AbstractResource) Wrap(obj ObjectData) (Object, error)

type Clients

type Clients struct {
	// contains filtered or unexported fields
}

func NewClients

func NewClients(config restclient.Config, scheme *runtime.Scheme) *Clients

func (*Clients) GetClient

func (c *Clients) GetClient(gv schema.GroupVersion) (restclient.Interface, error)

func (*Clients) GetCodecFactory

func (c *Clients) GetCodecFactory() serializer.CodecFactory

func (*Clients) GetParameterCodec

func (c *Clients) GetParameterCodec() runtime.ParameterCodec

func (*Clients) NewFor

func (c *Clients) NewFor(config restclient.Config) *Clients

type Cluster

type Cluster interface {
	ResourcesSource
	ClusterSource
	GetServerVersion() *semver.Version

	GetName() string
	GetId() string
	Config() restclient.Config

	GetAttr(key interface{}) interface{}
	SetAttr(key, value interface{})
}

type ClusterGroupKind added in v0.2.0

type ClusterGroupKind = abstract.ClusterGroupKind

type ClusterGroupKindSet added in v0.2.0

type ClusterGroupKindSet = abstract.ClusterGroupKindSet

func NewClusterGroupKindSet added in v0.2.0

func NewClusterGroupKindSet(a ...ClusterGroupKind) ClusterGroupKindSet

func NewClusterGroupKindSetByArray added in v0.2.0

func NewClusterGroupKindSetByArray(a []ClusterGroupKind) ClusterGroupKindSet

func NewClusterGroupKindSetBySets added in v0.2.0

func NewClusterGroupKindSetBySets(sets ...ClusterGroupKindSet) ClusterGroupKindSet

type ClusterObjectKey

type ClusterObjectKey = abstract.ClusterObjectKey

func NewClusterKey

func NewClusterKey(cluster string, groupKind schema.GroupKind, namespace, name string) ClusterObjectKey

func NewClusterKeyForObject

func NewClusterKeyForObject(cluster string, key ObjectKey) ClusterObjectKey

func ParseClusterObjectKey

func ParseClusterObjectKey(clusterid string, key string) (ClusterObjectKey, error)

type ClusterObjectKeySet

type ClusterObjectKeySet = abstract.ClusterObjectKeySet

func FilterKeysByGroupKinds

func FilterKeysByGroupKinds(keys ClusterObjectKeySet, kinds ...schema.GroupKind) ClusterObjectKeySet

func NewClusterObjectKeSetBySets

func NewClusterObjectKeSetBySets(sets ...ClusterObjectKeySet) ClusterObjectKeySet

func NewClusterObjectKeySet

func NewClusterObjectKeySet(a ...ClusterObjectKey) ClusterObjectKeySet

func NewClusterObjectKeySetByArray

func NewClusterObjectKeySetByArray(a []ClusterObjectKey) ClusterObjectKeySet

type ClusterSource

type ClusterSource interface {
	GetCluster() Cluster
}

type Decoder added in v0.2.0

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder knows how to decode the contents of an admission request into a concrete object.

func NewDecoder added in v0.2.0

func NewDecoder(scheme *runtime.Scheme) *Decoder

NewDecoder creates a Decoder given the runtime.Scheme

func (*Decoder) CodecFactory added in v0.2.0

func (d *Decoder) CodecFactory() serializer.CodecFactory

func (*Decoder) Decode added in v0.2.0

func (d *Decoder) Decode(content []byte) (runtime.Object, *schema.GroupVersionKind, error)

Decode decodes the inlined object.

func (*Decoder) DecodeFromMap added in v0.2.0

func (d *Decoder) DecodeFromMap(data map[string]interface{}, into runtime.Object) error

DecodeFromMap decodes from a map into a runtime Object. data is a JSON compatible map with string, float, int, bool, []interface{}, or map[string]interface{} children.

func (*Decoder) DecodeFromUnstructued added in v0.2.0

func (d *Decoder) DecodeFromUnstructued(data *unstructured.Unstructured, into runtime.Object) error

DecodeFromUnstructued decodes an unstruvtured object into a structured one

func (*Decoder) DecodeInto added in v0.2.0

func (d *Decoder) DecodeInto(data []byte, into interface{}) error

DecodeInto decodes on object given as byte stream into a runtimeObject or similar Object

func (*Decoder) DecodeRaw added in v0.2.0

func (d *Decoder) DecodeRaw(rawObj runtime.RawExtension, into interface{}) error

DecodeRaw decodes a RawExtension object into the passed-in runtime.Object.

type EventRecorder

type EventRecorder interface {
	Event(eventtype, reason, message string)

	// Eventf is just like Event, but with Sprintf for the message field.
	Eventf(eventtype, reason, messageFmt string, args ...interface{})

	// PastEventf is just like Eventf, but with an option to specify the event's 'timestamp' field.
	PastEventf(timestamp metav1.Time, eventtype, reason, messageFmt string, args ...interface{})

	// AnnotatedEventf is just like eventf, but with annotations attached
	AnnotatedEventf(annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{})
}

type GenericFilteredInformerFactory

type GenericFilteredInformerFactory interface {
	GenericInformerFactory
	FilteredInformerFor(gvk schema.GroupVersionKind, namespace string, optionsFunc TweakListOptionsFunc) (GenericInformer, error)
	LookupInformerFor(gvk schema.GroupVersionKind, namespace string) (GenericInformer, error)
}

type GenericInformer

type GenericInformer interface {
	cache.SharedIndexInformer
	Informer() cache.SharedIndexInformer
	Lister() Lister
}

type GenericInformerFactory

type GenericInformerFactory interface {
	InformerFor(gvk schema.GroupVersionKind) (GenericInformer, error)
	Start(stopCh <-chan struct{})
	WaitForCacheSync(stopCh <-chan struct{})
}

type GenericObjectName added in v0.2.0

type GenericObjectName = abstract.GenericObjectName

type GroupKindProvider

type GroupKindProvider = abstract.GroupKindProvider

type GroupKindSet

type GroupKindSet = abstract.GroupKindSet

func NewGroupKindSet

func NewGroupKindSet(a ...schema.GroupKind) GroupKindSet

func NewGroupKindSetByArray

func NewGroupKindSetByArray(a []schema.GroupKind) GroupKindSet

func NewGroupKindSetBySets added in v0.2.0

func NewGroupKindSetBySets(sets ...GroupKindSet) GroupKindSet

type I_Object

type I_Object interface {
	Object

	I_modify(status_only, create bool, modifier Modifier) (bool, error)
	I_resource() Internal
}

I_Object is the internal object interface used by the Abstract Object implementation to implement standart object methods.

type Info

type Info struct {
	// contains filtered or unexported fields
}

func (*Info) Group

func (this *Info) Group() string

func (*Info) GroupKind

func (this *Info) GroupKind() schema.GroupKind

func (*Info) GroupVersion

func (this *Info) GroupVersion() schema.GroupVersion

func (*Info) GroupVersionKind

func (this *Info) GroupVersionKind() schema.GroupVersionKind

func (*Info) GroupVersionResource

func (this *Info) GroupVersionResource() schema.GroupVersionResource

func (*Info) HasStatusSubResource

func (this *Info) HasStatusSubResource() bool

func (*Info) HasSubResource

func (this *Info) HasSubResource(name string) bool

func (*Info) InfoString

func (this *Info) InfoString() string

func (*Info) Kind

func (this *Info) Kind() string

func (*Info) Name

func (this *Info) Name() string

func (*Info) Namespaced

func (this *Info) Namespaced() bool

func (*Info) String

func (this *Info) String() string

func (*Info) SubResources

func (this *Info) SubResources() utils.StringSet

func (*Info) Version

func (this *Info) Version() string

type IngressObject

type IngressObject struct {
	Object
}

func GetCachedIngress

func GetCachedIngress(src ResourcesSource, namespace, name string) (*IngressObject, error)

func GetIngress

func GetIngress(src ResourcesSource, namespace, name string) (*IngressObject, error)

func Ingress

func Ingress(o Object) *IngressObject

func (*IngressObject) Ingress

func (this *IngressObject) Ingress() *api.Ingress

type Interface

type Interface interface {
	abstract.Resource
	ClusterSource
	ResourcesSource

	Name() string
	Namespaced() bool
	Info() *Info
	ResourceContext() ResourceContext
	AddSelectedEventHandler(eventHandlers ResourceEventHandlerFuncs, namespace string, optionsFunc TweakListOptionsFunc) error
	AddEventHandler(eventHandlers ResourceEventHandlerFuncs) error
	AddRawEventHandler(handlers cache.ResourceEventHandlerFuncs) error

	Wrap(ObjectData) (Object, error)
	New(ObjectName) Object

	GetInto(ObjectName, ObjectData) (Object, error)

	GetCached(interface{}) (Object, error)
	// GET_ deprecrated: use Get
	Get_(obj interface{}) (Object, error)
	Get(obj interface{}) (Object, error)
	ListCached(selector labels.Selector) ([]Object, error)
	List(opts metav1.ListOptions) (ret []Object, err error)
	Create(ObjectData) (Object, error)
	CreateOrUpdate(obj ObjectData) (Object, error)
	Update(ObjectData) (Object, error)
	Modify(obj ObjectData, modifier Modifier) (ObjectData, bool, error)
	ModifyByName(obj ObjectDataName, modifier Modifier) (Object, bool, error)
	CreateOrModifyByName(obj ObjectDataName, modifier Modifier) (Object, bool, error)
	ModifyStatus(obj ObjectData, modifier Modifier) (ObjectData, bool, error)
	ModifyStatusByName(obj ObjectDataName, modifier Modifier) (Object, bool, error)
	Delete(ObjectData) error
	DeleteByName(ObjectDataName) error

	NormalEventf(name ObjectDataName, reason, msgfmt string, args ...interface{})
	WarningEventf(name ObjectDataName, reason, msgfmt string, args ...interface{})

	Namespace(name string) Namespaced

	IsUnstructured() bool
}

type Internal

type Internal interface {
	Interface
	Resource() Interface

	I_CreateData(name ...ObjectDataName) ObjectData

	I_create(data ObjectData) (ObjectData, error)
	I_get(data ObjectData) error
	I_update(data ObjectData) (ObjectData, error)
	I_updateStatus(data ObjectData) (ObjectData, error)
	I_delete(data ObjectDataName) error

	I_modifyByName(name ObjectDataName, status_only, create bool, modifier Modifier) (Object, bool, error)
	I_modify(data ObjectData, status_only, read, create bool, modifier Modifier) (ObjectData, bool, error)

	I_getInformer(namespace string, optionsFunc TweakListOptionsFunc) (GenericInformer, error)
	I_lookupInformer(namespace string) (GenericInformer, error)
	I_list(namespace string, opts metav1.ListOptions) ([]Object, error)
}

type KeyFilter

type KeyFilter func(key ClusterObjectKey) bool

func NewGroupKindFilter

func NewGroupKindFilter(gk schema.GroupKind) KeyFilter

type Lister

type Lister interface {
	List(selector labels.Selector, consumer func(o interface{})) error
	Namespace(namespace string) NamespacedLister
	Get(name string) (ObjectData, error)
}

func NewLister

func NewLister(indexer cache.Indexer, resource *Info) Lister

type ModificationState

type ModificationState struct {
	*abstract.ModificationState
}

func NewModificationState

func NewModificationState(object Object, mod ...bool) *ModificationState

func (*ModificationState) AddOwners

func (this *ModificationState) AddOwners(objs ...Object) *ModificationState

func (*ModificationState) AssureLabel

func (this *ModificationState) AssureLabel(name, value string) *ModificationState

func (*ModificationState) Object

func (this *ModificationState) Object() Object

func (*ModificationState) Update

func (this *ModificationState) Update() error

func (*ModificationState) UpdateStatus

func (this *ModificationState) UpdateStatus() error

type ModificationStatusUpdater added in v0.2.0

type ModificationStatusUpdater interface {
	IsModified() bool
	ObjectStatusUpdater
}

type ModificationUpdater added in v0.2.0

type ModificationUpdater interface {
	IsModified() bool
	ObjectUpdater
}

type Modifier

type Modifier func(ObjectData) (bool, error)

type Namespaced

type Namespaced interface {
	ListCached(selector labels.Selector) ([]Object, error)
	List(opts metav1.ListOptions) (ret []Object, err error)
	GetCached(name string) (Object, error)
	Get(name string) (Object, error)
}

type NamespacedLister

type NamespacedLister interface {
	List(selector labels.Selector, consumer func(o interface{})) error
	Get(name string) (ObjectData, error)
}

type Object

type Object interface {
	abstract.Object
	// runtime.ObjectData
	EventRecorder
	ResourcesSource
	ClusterSource

	DeepCopy() Object
	ClusterKey() ClusterObjectKey
	IsCoLocatedTo(o Object) bool

	GetResource() Interface

	Create() error
	CreateOrUpdate() error
	Delete() error
	Update() error
	UpdateStatus() error
	Modify(modifier Modifier) (bool, error)
	ModifyStatus(modifier Modifier) (bool, error)
	CreateOrModify(modifier Modifier) (bool, error)
	UpdateFromCache() error

	GetOwners(kinds ...schema.GroupKind) ClusterObjectKeySet
	AddOwner(Object) bool
	RemoveOwner(Object) bool
}

type ObjectData

type ObjectData = abstract.ObjectData

type ObjectDataName

type ObjectDataName = abstract.ObjectDataName

type ObjectFilter

type ObjectFilter func(obj Object) bool

type ObjectKey

type ObjectKey = abstract.ObjectKey

func IngressKey

func IngressKey(namespace, name string) ObjectKey

func NewKey

func NewKey(groupKind schema.GroupKind, namespace, name string) ObjectKey

func NewKeyForData added in v0.2.0

func NewKeyForData(data ObjectData) ObjectKey

func SecretKey

func SecretKey(namespace, name string) ObjectKey

func SecretKeyByRef

func SecretKeyByRef(ref *api.SecretReference) ObjectKey

func ServiceKey

func ServiceKey(namespace, name string) ObjectKey

type ObjectMatcher

type ObjectMatcher func(Object) bool

type ObjectName

type ObjectName = abstract.ObjectName

func NewObjectNameForData added in v0.2.0

func NewObjectNameForData(data ObjectData) ObjectName

type ObjectNameProvider

type ObjectNameProvider = abstract.ObjectNameProvider

type ObjectNameSet

type ObjectNameSet = abstract.ObjectNameSet

func NewObjectNameSet

func NewObjectNameSet(a ...ObjectName) ObjectNameSet

func NewObjectNameSetByArray

func NewObjectNameSetByArray(a []ObjectName) ObjectNameSet

func NewObjectNameSetBySets

func NewObjectNameSetBySets(sets ...ObjectNameSet) ObjectNameSet

type ObjectStatusUpdater added in v0.2.0

type ObjectStatusUpdater interface {
	UpdateStatus() error
}

type ObjectUpdater added in v0.2.0

type ObjectUpdater interface {
	Update() error
}

type OwnerDetector

type OwnerDetector func(sub Object) ClusterObjectKeySet

type ResourceContext

type ResourceContext interface {
	abstract.ResourceContext
	GetResourceInfos(gv schema.GroupVersion) []*Info
	Cluster

	GetParameterCodec() runtime.ParameterCodec
	GetClient(gv schema.GroupVersion) (restclient.Interface, error)

	SharedInformerFactory() SharedInformerFactory

	GetPreferred(gk schema.GroupKind) (*Info, error)
	Get(gvk schema.GroupVersionKind) (*Info, error)
}

func NewResourceContext

func NewResourceContext(ctx context.Context, c Cluster, scheme *runtime.Scheme, defaultResync time.Duration) (ResourceContext, error)

type ResourceEventHandlerFuncs

type ResourceEventHandlerFuncs struct {
	AddFunc    func(obj Object)
	UpdateFunc func(oldObj, newObj Object)
	DeleteFunc func(obj Object)
}

type ResourceHelper

type ResourceHelper struct {
	Internal
}

func (*ResourceHelper) Get

func (this *ResourceHelper) Get(namespace, name string, result ObjectData) (Object, error)

func (*ResourceHelper) ObjectAsResource

func (this *ResourceHelper) ObjectAsResource(obj ObjectData) Object

type ResourceInfos

type ResourceInfos struct {
	// contains filtered or unexported fields
}

func NewResourceInfos

func NewResourceInfos(c Cluster) (*ResourceInfos, error)

func (*ResourceInfos) Get

func (this *ResourceInfos) Get(gvk schema.GroupVersionKind) (*Info, error)

func (*ResourceInfos) GetGroups

func (this *ResourceInfos) GetGroups() []schema.GroupVersion

func (*ResourceInfos) GetPreferred

func (this *ResourceInfos) GetPreferred(gk schema.GroupKind) (*Info, error)

func (*ResourceInfos) GetResourceInfos

func (this *ResourceInfos) GetResourceInfos(gv schema.GroupVersion) []*Info

func (*ResourceInfos) GetServerVersion

func (this *ResourceInfos) GetServerVersion() *semver.Version

func (*ResourceInfos) RESTMapping

func (this *ResourceInfos) RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)

type Resources

type Resources interface {
	abstract.Resources
	ResourcesSource
	record.EventRecorder

	Get(interface{}) (Interface, error)
	GetByExample(obj runtime.Object) (Interface, error)
	GetByGK(gk schema.GroupKind) (Interface, error)
	GetByGVK(gvk schema.GroupVersionKind) (Interface, error)

	GetUnstructured(spec interface{}) (Interface, error)
	GetUnstructuredByGK(gk schema.GroupKind) (Interface, error)
	GetUnstructuredByGVK(gvk schema.GroupVersionKind) (Interface, error)

	Wrap(obj ObjectData) (Object, error)
	Decode(bytes []byte) (Object, error)

	GetObjectInto(ObjectName, ObjectData) (Object, error)

	GetObject(spec interface{}) (Object, error)
	GetCachedObject(spec interface{}) (Object, error)

	CreateObject(ObjectData) (Object, error)
	CreateOrUpdateObject(obj ObjectData) (Object, error)

	UpdateObject(obj ObjectData) (Object, error)
	ModifyObject(obj ObjectData, modifier func(data ObjectData) (bool, error)) (ObjectData, bool, error)
	ModifyObjectStatus(obj ObjectData, modifier func(data ObjectData) (bool, error)) (ObjectData, bool, error)
	DeleteObject(obj ObjectData) error
}

type ResourcesSource

type ResourcesSource interface {
	Resources() Resources
}

type SecretObject

type SecretObject struct {
	Object
}

func GetCachedSecret

func GetCachedSecret(src ResourcesSource, namespace, name string) (*SecretObject, error)

func GetCachedSecretByRef

func GetCachedSecretByRef(src ResourcesSource, ref *api.SecretReference) (*SecretObject, error)

func GetCachedSecretProperties

func GetCachedSecretProperties(src ResourcesSource, namespace, name string) (utils.Properties, *SecretObject, error)

func GetCachedSecretPropertiesByRef

func GetCachedSecretPropertiesByRef(src ResourcesSource, ref *api.SecretReference) (utils.Properties, *SecretObject, error)

func GetSecret

func GetSecret(src ResourcesSource, namespace, name string) (*SecretObject, error)

func GetSecretByRef

func GetSecretByRef(src ResourcesSource, ref *api.SecretReference) (*SecretObject, error)

func GetSecretProperties

func GetSecretProperties(src ResourcesSource, namespace, name string) (utils.Properties, *SecretObject, error)

func GetSecretPropertiesByRef

func GetSecretPropertiesByRef(src ResourcesSource, ref *api.SecretReference) (utils.Properties, *SecretObject, error)

func Secret

func Secret(o Object) *SecretObject

func (*SecretObject) GetData

func (this *SecretObject) GetData() map[string][]byte

func (*SecretObject) Secret

func (this *SecretObject) Secret() *api.Secret

type ServiceObject

type ServiceObject struct {
	Object
}

func GetCachedService

func GetCachedService(src ResourcesSource, namespace, name string) (*ServiceObject, error)

func GetService

func GetService(src ResourcesSource, namespace, name string) (*ServiceObject, error)

func Service

func Service(o Object) *ServiceObject

func (*ServiceObject) Service

func (this *ServiceObject) Service() *api.Service

func (*ServiceObject) Spec

func (this *ServiceObject) Spec() *api.ServiceSpec

func (*ServiceObject) Status

func (this *ServiceObject) Status() *api.ServiceStatus

type SharedInformerFactory

type SharedInformerFactory interface {
	Structured() GenericFilteredInformerFactory
	Unstructured() GenericFilteredInformerFactory

	InformerForObject(obj runtime.Object) (GenericInformer, error)
	FilteredInformerForObject(obj runtime.Object, namespace string, optionsFunc TweakListOptionsFunc) (GenericInformer, error)

	InformerFor(gvk schema.GroupVersionKind) (GenericInformer, error)
	FilteredInformerFor(gvk schema.GroupVersionKind, namespace string, optionsFunc TweakListOptionsFunc) (GenericInformer, error)

	UnstructuredInformerFor(gvk schema.GroupVersionKind) (GenericInformer, error)
	FilteredUnstructuredInformerFor(gvk schema.GroupVersionKind, namespace string, optionsFunc TweakListOptionsFunc) (GenericInformer, error)

	Start(stopCh <-chan struct{})
	WaitForCacheSync(stopCh <-chan struct{})
}

SharedInformerFactory provides shared informers for resources in all known API group versions.

type SlaveCache

type SlaveCache struct {
	// contains filtered or unexported fields
}

func NewSlaveCache

func NewSlaveCache() *SlaveCache

func (*SlaveCache) AddOwnerFilter

func (this *SlaveCache) AddOwnerFilter(filters ...KeyFilter) *SlaveCache

func (*SlaveCache) AddSlave

func (this *SlaveCache) AddSlave(obj Object, slave Object) error

func (*SlaveCache) AddSlaveFilter

func (this *SlaveCache) AddSlaveFilter(filters ...ObjectFilter) *SlaveCache

func (*SlaveCache) CreateOrModifySlave added in v0.2.0

func (this *SlaveCache) CreateOrModifySlave(obj Object, slave Object, mod Modifier) (bool, error)

func (*SlaveCache) CreateSlave

func (this *SlaveCache) CreateSlave(obj Object, slave Object) error

func (*SlaveCache) DeleteOwner

func (this *SlaveCache) DeleteOwner(key ClusterObjectKey)

func (*SlaveCache) DeleteSlave

func (this *SlaveCache) DeleteSlave(key ClusterObjectKey)

func (*SlaveCache) Get

func (this *SlaveCache) Get(obj Object) []Object

Get is replaced by GetByOwner Deprecated: Please use GetByOwner

func (*SlaveCache) GetByKey

func (this *SlaveCache) GetByKey(key ClusterObjectKey) []Object

GetByKey is replaced by GetByOwnerKey Deprecated: Please use GetByOwnerKey

func (*SlaveCache) GetByOwner

func (this *SlaveCache) GetByOwner(obj Object) []Object

func (*SlaveCache) GetByOwnerKey

func (this *SlaveCache) GetByOwnerKey(key ClusterObjectKey) []Object

func (*SlaveCache) GetOwners

func (this *SlaveCache) GetOwners(kinds ...schema.GroupKind) ClusterObjectKeySet

func (*SlaveCache) GetOwnersFor

func (this *SlaveCache) GetOwnersFor(key ClusterObjectKey, kinds ...schema.GroupKind) ClusterObjectKeySet

func (*SlaveCache) GetSlave

func (this *SlaveCache) GetSlave(key ClusterObjectKey) Object

func (*SlaveCache) Remove

func (this *SlaveCache) Remove(obj Object, slave Object) bool

func (*SlaveCache) RenewSlaveObject

func (this *SlaveCache) RenewSlaveObject(obj Object) bool

func (*SlaveCache) Setup

func (this *SlaveCache) Setup(slaves []Object)

func (*SlaveCache) Size

func (this *SlaveCache) Size() int

func (*SlaveCache) SlaveCount

func (this *SlaveCache) SlaveCount() int

func (*SlaveCache) UpdateSlave

func (this *SlaveCache) UpdateSlave(obj Object) error

type SubObjectCache

type SubObjectCache struct {
	// contains filtered or unexported fields
}

func NewSubObjectCache

func NewSubObjectCache(o OwnerDetector) *SubObjectCache

func (*SubObjectCache) AddOwnerFilter

func (this *SubObjectCache) AddOwnerFilter(filters ...KeyFilter) *SubObjectCache

func (*SubObjectCache) AddSubObjectFilter

func (this *SubObjectCache) AddSubObjectFilter(filters ...ObjectFilter) *SubObjectCache

func (*SubObjectCache) CreateOrModifySubObject added in v0.2.0

func (this *SubObjectCache) CreateOrModifySubObject(sub Object, mod Modifier) (bool, error)

func (*SubObjectCache) CreateSubObject

func (this *SubObjectCache) CreateSubObject(sub Object) error

func (*SubObjectCache) DeleteOwner

func (this *SubObjectCache) DeleteOwner(key ClusterObjectKey)

func (*SubObjectCache) DeleteSubObject

func (this *SubObjectCache) DeleteSubObject(key ClusterObjectKey)

func (*SubObjectCache) Get

func (this *SubObjectCache) Get(obj Object) []Object

Get is replaced by GetByOwner Deprecated: Please use GetByOwner

func (*SubObjectCache) GetAllOwners

func (this *SubObjectCache) GetAllOwners(kind ...schema.GroupKind) ClusterObjectKeySet

func (*SubObjectCache) GetByKey

func (this *SubObjectCache) GetByKey(key ClusterObjectKey) []Object

GetByKey is replaced by GetByOwnerKey Deprecated: Please use GetByOwnerKey

func (*SubObjectCache) GetByOwner

func (this *SubObjectCache) GetByOwner(obj Object) []Object

func (*SubObjectCache) GetByOwnerKey

func (this *SubObjectCache) GetByOwnerKey(key ClusterObjectKey) []Object

func (*SubObjectCache) GetOwners

func (this *SubObjectCache) GetOwners(key ClusterObjectKey, kinds ...schema.GroupKind) ClusterObjectKeySet

func (*SubObjectCache) GetSubObject

func (this *SubObjectCache) GetSubObject(key ClusterObjectKey) Object

func (*SubObjectCache) RenewSubObject

func (this *SubObjectCache) RenewSubObject(obj Object) bool

func (*SubObjectCache) Setup

func (this *SubObjectCache) Setup(subObjects []Object)

func (*SubObjectCache) Size

func (this *SubObjectCache) Size() int

func (*SubObjectCache) SubObjectCount

func (this *SubObjectCache) SubObjectCount() int

func (*SubObjectCache) UpdateSubObject

func (this *SubObjectCache) UpdateSubObject(obj Object) error

type TweakListOptionsFunc

type TweakListOptionsFunc func(*metav1.ListOptions)

TweakListOptionsFunc defines the signature of a helper function that wants to provide more listing options to API

type UsageCache

type UsageCache struct {
	// contains filtered or unexported fields
}

func NewUsageCache

func NewUsageCache(u UsedExtractor) *UsageCache

func (*UsageCache) AddOwnerFilter

func (this *UsageCache) AddOwnerFilter(filters ...KeyFilter) *UsageCache

func (*UsageCache) DeleteOwner

func (this *UsageCache) DeleteOwner(key ClusterObjectKey)

func (*UsageCache) GetOwners

func (this *UsageCache) GetOwners() ClusterObjectKeySet

func (*UsageCache) GetOwnersFor

func (this *UsageCache) GetOwnersFor(key ClusterObjectKey, kinds ...schema.GroupKind) ClusterObjectKeySet

func (*UsageCache) GetUsages

func (this *UsageCache) GetUsages(key ClusterObjectKey) ClusterObjectKeySet

func (*UsageCache) GetUsed

func (this *UsageCache) GetUsed() ClusterObjectKeySet

func (*UsageCache) RenewOwner

func (this *UsageCache) RenewOwner(obj Object) bool

func (*UsageCache) Setup

func (this *UsageCache) Setup(owners []Object)

func (*UsageCache) Size

func (this *UsageCache) Size() int

func (*UsageCache) UsedCount

func (this *UsageCache) UsedCount() int

type UsedExtractor

type UsedExtractor func(sub Object) ClusterObjectKeySet

type VersionedObjects added in v0.2.0

type VersionedObjects struct {
	// Objects is the set of objects retrieved during decoding, in order of conversion.
	// The 0 index is the object as serialized on the wire. If conversion has occurred,
	// other objects may be present. The right most object is the same as would be returned
	// by a normal Decode call.
	Objects []runtime.Object
}

VersionedObjects is used by Decoders to give callers a way to access all versions of an object during the decoding process.

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +k8s:deepcopy-gen=true

func (*VersionedObjects) DeepCopyObject added in v0.2.0

func (obj *VersionedObjects) DeepCopyObject() runtime.Object

DeepCopyObject returns a deep copy

func (*VersionedObjects) First added in v0.2.0

func (obj *VersionedObjects) First() runtime.Object

First returns the leftmost object in the VersionedObjects array, which is usually the object as serialized on the wire.

func (*VersionedObjects) GetObjectKind added in v0.2.0

func (obj *VersionedObjects) GetObjectKind() schema.ObjectKind

GetObjectKind implements Object for VersionedObjects, returning an empty ObjectKind interface if no objects are provided, or the ObjectKind interface of the object in the highest array position.

func (*VersionedObjects) Last added in v0.2.0

func (obj *VersionedObjects) Last() runtime.Object

Last is the rightmost object in the VersionedObjects array, which is the object after all transformations have been applied. This is the same object that would be returned by Decode in a normal invocation (without VersionedObjects in the into argument).

Directories

Path Synopsis
defaultscheme

Jump to

Keyboard shortcuts

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