collections

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 11 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseOldResourceFilters added in v1.11.0

func UseOldResourceFilters(backupSpec velerov1api.BackupSpec) bool

UseOldResourceFilters checks whether to use old resource filters (IncludeClusterResources, IncludedResources and ExcludedResources), depending the backup's filters setting. New filters are IncludedClusterScopedResources, ExcludedClusterScopedResources, IncludedNamespaceScopedResources and ExcludedNamespaceScopedResources.

func ValidateIncludesExcludes

func ValidateIncludesExcludes(includesList, excludesList []string) []error

ValidateIncludesExcludes checks provided lists of included and excluded items to ensure they are a valid set of IncludesExcludes data.

func ValidateNamespaceIncludesExcludes added in v1.7.0

func ValidateNamespaceIncludesExcludes(includesList, excludesList []string) []error

ValidateNamespaceIncludesExcludes checks provided lists of included and excluded namespaces to ensure they are a valid set of IncludesExcludes data.

func ValidateScopedIncludesExcludes added in v1.11.0

func ValidateScopedIncludesExcludes(includesList, excludesList []string) []error

ValidateScopedIncludesExcludes checks provided lists of namespace-scoped or cluster-scoped included and excluded items to ensure they are a valid set of IncludesExcludes data.

Types

type GlobalIncludesExcludes added in v1.11.0

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

func GetGlobalResourceIncludesExcludes added in v1.11.0

func GetGlobalResourceIncludesExcludes(helper discovery.Helper, logger logrus.FieldLogger, includes, excludes []string, includeClusterResources *bool, nsIncludesExcludes IncludesExcludes) *GlobalIncludesExcludes

func (*GlobalIncludesExcludes) ShouldExclude added in v1.11.0

func (ie *GlobalIncludesExcludes) ShouldExclude(typeName string) bool

ShouldExclude returns whether the resource type should be excluded or not.

func (*GlobalIncludesExcludes) ShouldInclude added in v1.11.0

func (ie *GlobalIncludesExcludes) ShouldInclude(typeName string) bool

ShouldInclude returns whether the specified item should be included or not. Everything in the includes list except those items in the excludes list should be included. It has some exceptional cases. When IncludeClusterResources is set to false, no need to check the filter, all cluster resources are excluded.

type IncludesExcludes

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

IncludesExcludes is a type that manages lists of included and excluded items. The logic implemented is that everything in the included list except those items in the excluded list should be included. '*' in the includes list means "include everything", but it is not valid in the exclude list.

func GetResourceIncludesExcludes added in v1.5.0

func GetResourceIncludesExcludes(helper discovery.Helper, includes, excludes []string) *IncludesExcludes

GetResourceIncludesExcludes takes the lists of resources to include and exclude, uses the discovery helper to resolve them to fully-qualified group-resource names, and returns an IncludesExcludes list.

func NewIncludesExcludes

func NewIncludesExcludes() *IncludesExcludes

func (*IncludesExcludes) Excludes

func (ie *IncludesExcludes) Excludes(excludes ...string) *IncludesExcludes

Excludes adds items to the excludes list

func (*IncludesExcludes) ExcludesString added in v0.5.0

func (ie *IncludesExcludes) ExcludesString() string

ExcludesString returns a string containing all of the excludes, separated by commas, or <none> if the list is empty.

func (*IncludesExcludes) GetExcludes

func (ie *IncludesExcludes) GetExcludes() []string

GetExcludes returns the items in the excludes list

func (*IncludesExcludes) GetIncludes

func (ie *IncludesExcludes) GetIncludes() []string

GetIncludes returns the items in the includes list

func (*IncludesExcludes) IncludeEverything added in v0.5.0

func (ie *IncludesExcludes) IncludeEverything() bool

IncludeEverything returns true if the includes list is empty or '*' and the excludes list is empty, or false otherwise.

func (*IncludesExcludes) Includes

func (ie *IncludesExcludes) Includes(includes ...string) *IncludesExcludes

Includes adds items to the includes list. '*' is a wildcard value meaning "include everything".

func (*IncludesExcludes) IncludesString added in v0.5.0

func (ie *IncludesExcludes) IncludesString() string

IncludesString returns a string containing all of the includes, separated by commas, or * if the list is empty.

func (*IncludesExcludes) ShouldInclude

func (ie *IncludesExcludes) ShouldInclude(s string) bool

ShouldInclude returns whether the specified item should be included or not. Everything in the includes list except those items in the excludes list should be included.

type IncludesExcludesInterface added in v1.11.0

type IncludesExcludesInterface interface {
	// Check whether the type name passed in by parameter should be included.
	// typeName should be k8s.io/apimachinery/pkg/runtime/schema GroupResource's String() result.
	ShouldInclude(typeName string) bool

	// Check whether the type name passed in by parameter should be excluded.
	// typeName should be k8s.io/apimachinery/pkg/runtime/schema GroupResource's String() result.
	ShouldExclude(typeName string) bool
}

IncludesExcludesInterface is used as polymorphic IncludesExcludes for Global and scope resources Include/Exclude.

type ScopeIncludesExcludes added in v1.11.0

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

func GetScopeResourceIncludesExcludes added in v1.11.0

func GetScopeResourceIncludesExcludes(helper discovery.Helper, logger logrus.FieldLogger, namespaceIncludes, namespaceExcludes, clusterIncludes, clusterExcludes []string, nsIncludesExcludes IncludesExcludes) *ScopeIncludesExcludes

GetScopeResourceIncludesExcludes's function is similar with GetResourceIncludesExcludes, but it's used for scoped Includes/Excludes, and can handle both cluster-scoped and namespace-scoped resources.

func (*ScopeIncludesExcludes) ShouldExclude added in v1.11.0

func (ie *ScopeIncludesExcludes) ShouldExclude(typeName string) bool

ShouldExclude returns whether the resource type should be excluded or not. For ScopeIncludesExcludes, if the resource type is specified in the exclude list, it should be excluded.

func (*ScopeIncludesExcludes) ShouldInclude added in v1.11.0

func (ie *ScopeIncludesExcludes) ShouldInclude(typeName string) bool

ShouldInclude returns whether the specified resource should be included or not. The function will check whether the resource is namespace-scoped resource first. For namespace-scoped resource, except resources listed in excludes, other things should be included. For cluster-scoped resource, except resources listed in excludes, only include the resource specified by the included. It also has some exceptional checks. For namespace, as long as it's not excluded, it is involved. If all namespace-scoped resources are included, all cluster-scoped resource are returned to get a full backup.

Jump to

Keyboard shortcuts

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