resource

package
v0.0.0-...-5dcfbd0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package resource contains resource methods

Index

Constants

View Source
const (
	LifecycleManaged  = "managed"
	LifecycleReferred = "referred"
)

Common const definitions

Variables

This section is empty.

Functions

This section is empty.

Types

type GetObjectFn

type GetObjectFn func(interface{}) (*Object, error)

GetObjectFn is a type for any function that returns resource info

type LocalObjectReference

type LocalObjectReference struct {
	corev1.LocalObjectReference `json:",inline"`
}

LocalObjectReference with validation

func (*LocalObjectReference) Validate

func (s *LocalObjectReference) Validate(fp *field.Path, sfield string, errs field.ErrorList, required bool) field.ErrorList

Validate validates the LocalObjectReference

type Object

type Object struct {
	// Lifecycle can be: managed, reference
	Lifecycle string
	// Obj refers to the resource object  can be: sts, service, secret, pvc, ..
	Obj metav1.Object
	// ObjList refers to the list of resource objects
	ObjList metav1.ListInterface
}

Object is a container to capture the k8s resource info to be used by controller

func ObjFromFile

func ObjFromFile(path string, values interface{}, list metav1.ListInterface) (*Object, error)

ObjFromFile populates Object from file

func ObjFromString

func ObjFromString(spec string, values interface{}, list metav1.ListInterface) (*Object, error)

ObjFromString populates Object from string spec

func ReferredObject

func ReferredObject(obj metav1.Object, name, namespace string) Object

ReferredObject returns a reffered object

type ObjectBag

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

ObjectBag abstracts dealing with group of objects For now it is a simple list

func (*ObjectBag) Add

func (b *ObjectBag) Add(objs ...Object)

Add adds to the Object bag

func (*ObjectBag) Delete

func (b *ObjectBag) Delete(inobj metav1.Object)

Delete returns an item which matched the kind and name

func (*ObjectBag) Get

func (b *ObjectBag) Get(inobj metav1.Object, name, namespace string) metav1.Object

Get returns an item which matched the kind and name

func (*ObjectBag) Items

func (b *ObjectBag) Items() []Object

Items get items from the Object bag

func (*ObjectBag) Objs

func (b *ObjectBag) Objs() []metav1.Object

Objs get items from the Object bag

type Observable

type Observable struct {
	// ObjList refers to the list of resource objects
	ObjList metav1.ListInterface
	// Obj refers to the resource object  can be: sts, service, secret, pvc, ..
	Obj metav1.Object
	// Labels list of labels
	Labels map[string]string
	// Typemeta - needed for go test fake client
	Type metav1.TypeMeta
}

Observable captures the k8s resource info and selector to fetch child resources

func ObservablesFromObjects

func ObservablesFromObjects(scheme *runtime.Scheme, bag *ObjectBag, labels map[string]string) []Observable

ObservablesFromObjects returns ObservablesFromObjects

Jump to

Keyboard shortcuts

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