resources

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSupportedVerbs = metav1.Verbs{"get", "update", "list", "delete", "watch"}

DefaultSupportedVerbs is the list of verbs that is used when a *Finder is created via NewFinder.

Functions

func FindMatchingObject added in v0.0.2

func FindMatchingObject(haystack []runtime.Object, needle runtime.Object) (runtime.Object, bool)

FindMatching walks haystack and returns the first object matching needle if there is one. The second return value indicates whether the object was found or not.

func SortByKind added in v0.0.2

func SortByKind(objs []runtime.Object, order Order) []runtime.Object

SortByKind sorts a slice of runtime.Object in the given order.

func SortInfosByKind added in v0.0.2

func SortInfosByKind(infos []*resource.Info, order Order) []*resource.Info

SortInfosByKind sorts a slice of *resource.Info in the given order.

func ToInfoList added in v0.0.2

func ToInfoList(objs *unstructured.UnstructuredList, mapper meta.RESTMapper) ([]*resource.Info, error)

ToInfoList converts an unstructured.UnstructuredList to a resource info list. The mapper is used to obtain the REST mapping for each object.

func ToObjectList

func ToObjectList(infos []*resource.Info) []runtime.Object

ToObjectList converts given info list to a slice of runtime objects.

Types

type Decoder added in v0.0.2

type Decoder interface {
	// Decode decodes raw bytes into slices of runtime.Object.
	Decode(raw []byte) ([]runtime.Object, error)
}

Decoder is the interface of something that can decode raw bytes into slices of runtime.Object.

type Encoder added in v0.0.2

type Encoder interface {
	// Encode encodes slices of runtime.Object as bytes.
	Encode(objs []runtime.Object) ([]byte, error)
}

Encoder is the interface for an encoder that encodes multiple objects as slices of bytes.

type Finder added in v0.0.2

type Finder struct {
	DiscoveryClient discovery.DiscoveryInterface
	DynamicClient   dynamic.Interface
	Mapper          meta.RESTMapper
	SupportedVerbs  metav1.Verbs
}

Finder is a resource finder.

func NewFinder added in v0.0.2

func NewFinder(client discovery.DiscoveryInterface, dynamicClient dynamic.Interface, mapper meta.RESTMapper) *Finder

NewFinder creates a new *Finder value.

func (*Finder) FindByLabelSelector added in v0.0.2

func (f *Finder) FindByLabelSelector(selector string) ([]*resource.Info, error)

FindByLabelSelector finds all resources that match given label selector and returns the resource infos for them. It will only include resources that do at least support the verbs specified in f.SupportedVerbs.

type Order added in v0.0.2

type Order []string

Order is a slice of strings that defines the ordering of resources.

var ApplyOrder Order = []string{
	"Namespace",
	"ResourceQuota",
	"LimitRange",
	"PodSecurityPolicy",
	"PodDisruptionBudget",
	"Secret",
	"ConfigMap",
	"StorageClass",
	"PersistentVolume",
	"PersistentVolumeClaim",
	"ServiceAccount",
	"CustomResourceDefinition",
	"ClusterRole",
	"ClusterRoleBinding",
	"Role",
	"RoleBinding",
	"Service",
	"DaemonSet",
	"Pod",
	"ReplicationController",
	"ReplicaSet",
	"Deployment",
	"StatefulSet",
	"Job",
	"CronJob",
	"Ingress",
	"APIService",
}

ApplyOrder is the resource order for apply operations.

var DeleteOrder Order = []string{
	"APIService",
	"Ingress",
	"Service",
	"CronJob",
	"Job",
	"StatefulSet",
	"Deployment",
	"ReplicaSet",
	"ReplicationController",
	"Pod",
	"DaemonSet",
	"RoleBinding",
	"Role",
	"ClusterRoleBinding",
	"ClusterRole",
	"CustomResourceDefinition",
	"ServiceAccount",
	"PersistentVolumeClaim",
	"PersistentVolume",
	"StorageClass",
	"ConfigMap",
	"Secret",
	"PodDisruptionBudget",
	"PodSecurityPolicy",
	"LimitRange",
	"ResourceQuota",
	"Namespace",
}

DeleteOrder is the resource order for delete operations.

type Serializer added in v0.0.2

type Serializer interface {
	Encoder
	Decoder
}

Serializer can encode and decode slices of runtime.Object.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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