resourcecollector

package
v2.8.2-0...-dd449ac Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// StorkResourceHash is the annotation used to keep track of resources
	// updates
	StorkResourceHash = "stork.libopenstorage.org/resource-hash"
	// SkipModifyResources is the annotation used to skip update of resources
	SkipModifyResources = "stork.libopenstorage.org/skip-modify-resource"
	// ServiceKind for k8s service resources
	ServiceKind = "Service"
)

Variables

This section is empty.

Functions

func IsNsPresentInIncludeResource

func IsNsPresentInIncludeResource(includeObjects map[stork_api.ObjectInfo]bool, namespace string) bool

IsNsPresentInIncludeResource checks if a given ns is present in the IncludeResource object

func SkipResource

func SkipResource(annotations map[string]string) bool

SkipResource returns whether the annotations of the object require it to be skipped

Types

type Objects

type Objects struct {
	Items []runtime.Unstructured
	// contains filtered or unexported fields
}

Objects Collection of objects

type ResourceCollector

type ResourceCollector struct {
	Driver volume.Driver
	QPS    float32
	Burst  int

	Opts map[string]string
	// contains filtered or unexported fields
}

ResourceCollector is used to collect and process unstructured objects in namespaces and using label selectors

func (*ResourceCollector) ApplyResource

func (r *ResourceCollector) ApplyResource(
	dynamicInterface dynamic.Interface,
	object runtime.Unstructured,
) error

ApplyResource applies a given resource using the provided client interface

func (*ResourceCollector) DeleteResources

func (r *ResourceCollector) DeleteResources(
	dynamicInterface dynamic.Interface,
	objects []runtime.Unstructured,
) error

DeleteResources deletes given resources using the provided client interface

func (*ResourceCollector) GetResourceTypes

func (r *ResourceCollector) GetResourceTypes(
	optionalResourceTypes []string,
	allDrivers bool) ([]metav1.APIResource, error)

GetResourceTypes returns all the supported resource types by the collector

func (*ResourceCollector) GetResources

func (r *ResourceCollector) GetResources(
	namespaces []string,
	labelSelectors map[string]string,
	includeObjects map[stork_api.ObjectInfo]bool,
	optionalResourceTypes []string,
	allDrivers bool) ([]runtime.Unstructured, error)

GetResources gets all the resources in the given list of namespaces which match the labelSelectors

func (*ResourceCollector) GetResourcesForType

func (r *ResourceCollector) GetResourcesForType(
	resource metav1.APIResource,
	objects *Objects,
	namespaces []string,
	labelSelectors map[string]string,
	includeObjects map[stork_api.ObjectInfo]bool,
	allDrivers bool) (*Objects, error)

GetResourcesForType gets all the resources for the given type

func (*ResourceCollector) Init

func (r *ResourceCollector) Init(config *restclient.Config) error

Init initializes the resource collector

func (*ResourceCollector) PrepareResourceForApply

func (r *ResourceCollector) PrepareResourceForApply(
	object runtime.Unstructured,
	allObjects []runtime.Unstructured,
	includeObjects map[stork_api.ObjectInfo]bool,
	namespaceMappings map[string]string,
	storageClassMappings map[string]string,
	pvNameMappings map[string]string,
	optionalResourceTypes []string,
	vInfo []*stork_api.ApplicationRestoreVolumeInfo,
) (bool, error)

PrepareResourceForApply prepares the resource for apply including update namespace and any PV name updates. Should be called before DeleteResources and ApplyResource

Jump to

Keyboard shortcuts

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