collections

package
v0.0.0-...-1eaa894 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseOldResourceFilters

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

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

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

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

func GetGlobalResourceIncludesExcludes

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

func (*GlobalIncludesExcludes) ShouldExclude

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

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

func (*GlobalIncludesExcludes) ShouldInclude

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

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

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

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

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

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

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

func GetScopeResourceIncludesExcludes

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

GetScopeResourceIncludesExcludes 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

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

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
JackTT - Gopher 🇻🇳