filter

package
v0.99.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 12 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	ExcludeAll bool // highest priority
	// contains filtered or unexported fields
}

Filter holds filter configuration

func NewFilter

func NewFilter() Filter

NewFilter returns a new initialized Filter

func (*Filter) AppendExcludeGlobs

func (f *Filter) AppendExcludeGlobs(globExprs ...string) error

AppendExcludeGlobs sets globs for exclusion rules

func (*Filter) AppendExcludeNames

func (f *Filter) AppendExcludeNames(names ...string)

AppendExcludeNames appends explicit names to the exclude filter

func (*Filter) AppendIncludeNames

func (f *Filter) AppendIncludeNames(names ...string)

AppendIncludeNames appends explicit names to the include filter

func (*Filter) Match

func (f *Filter) Match(name string) bool

Match given name against the filter and returns true or false if it has to be included or excluded

type IAMServiceAccountFilter

type IAMServiceAccountFilter struct {
	*Filter
}

IAMServiceAccountFilter holds filter configuration

func NewIAMServiceAccountFilter

func NewIAMServiceAccountFilter() *IAMServiceAccountFilter

NewIAMServiceAccountFilter create new ServiceAccountFilter instance

func (*IAMServiceAccountFilter) AppendGlobs

func (f *IAMServiceAccountFilter) AppendGlobs(includeGlobExprs, excludeGlobExprs []string, serviceAccounts []*api.ClusterIAMServiceAccount) error

AppendGlobs appends globs for inclusion and exclusion rules

func (*IAMServiceAccountFilter) AppendIncludeGlobs

func (f *IAMServiceAccountFilter) AppendIncludeGlobs(serviceAccounts []*api.ClusterIAMServiceAccount, globExprs ...string) error

AppendIncludeGlobs sets globs for inclusion rules

func (*IAMServiceAccountFilter) FilterMatching

func (f *IAMServiceAccountFilter) FilterMatching(serviceAccounts []*api.ClusterIAMServiceAccount) []*api.ClusterIAMServiceAccount

FilterMatching matches names against the filter and returns all included service accounts

func (*IAMServiceAccountFilter) ForEach

func (f *IAMServiceAccountFilter) ForEach(serviceAccounts []*api.ClusterIAMServiceAccount, iterFn func(i int, sa *api.ClusterIAMServiceAccount) error) error

ForEach iterates over each nodegroup that is included by the filter and calls iterFn

func (*IAMServiceAccountFilter) LogInfo

func (f *IAMServiceAccountFilter) LogInfo(serviceAccounts []*api.ClusterIAMServiceAccount)

LogInfo prints out a user-friendly message about how filter was applied

func (*IAMServiceAccountFilter) MatchAll

func (f *IAMServiceAccountFilter) MatchAll(serviceAccounts []*api.ClusterIAMServiceAccount) (sets.String, sets.String)

MatchAll all names against the filter and return two sets of names - included and excluded

func (*IAMServiceAccountFilter) SetDeleteFilter added in v0.39.0

func (f *IAMServiceAccountFilter) SetDeleteFilter(ctx context.Context, lister serviceAccountLister, includeOnlyMissing bool, cfg *api.ClusterConfig) error

SetDeleteFilter uses stackManager to list existing iamserviceaccount stacks and configures the filter to either explictily exluce or include iamserviceaccounts that are missing from given serviceAccounts

func (*IAMServiceAccountFilter) SetExcludeExistingFilter

func (f *IAMServiceAccountFilter) SetExcludeExistingFilter(ctx context.Context, stackManager serviceAccountLister, clientSet kubernetes.Interface, serviceAccounts []*api.ClusterIAMServiceAccount, overrideExistingServiceAccounts bool) error

SetExcludeExistingFilter uses stackManager to list existing nodegroup stacks and configures the filter accordingly

type NodeGroupFilter

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

NodeGroupFilter holds filter configuration

func NewNodeGroupFilter

func NewNodeGroupFilter() *NodeGroupFilter

NewNodeGroupFilter creates a new NodeGroupFilter struct

func (*NodeGroupFilter) AppendExcludeGlobs

func (f *NodeGroupFilter) AppendExcludeGlobs(globExprs ...string) error

AppendExcludeGlobs sets globs for inclusion rules

func (*NodeGroupFilter) AppendGlobs

func (f *NodeGroupFilter) AppendGlobs(includeGlobExprs, excludeGlobExprs, ngNames []string) error

AppendGlobs appends globs for inclusion and exclusion rules

func (*NodeGroupFilter) AppendIncludeGlobs

func (f *NodeGroupFilter) AppendIncludeGlobs(ngNames []string, globExprs ...string) error

AppendIncludeGlobs sets globs for inclusion rules

func (*NodeGroupFilter) AppendIncludeNames

func (f *NodeGroupFilter) AppendIncludeNames(names ...string)

AppendIncludeNames sets globs for inclusion rules

func (*NodeGroupFilter) FilterMatching

func (f *NodeGroupFilter) FilterMatching(nodeGroups []*api.NodeGroup) []*api.NodeGroup

FilterMatching matches names against the filter and returns all included node groups

func (*NodeGroupFilter) ForEach

func (f *NodeGroupFilter) ForEach(nodeGroups []*api.NodeGroup, iterFn func(i int, ng *api.NodeGroup) error) error

ForEach iterates over each nodegroup that is included by the filter and calls iterFn

func (*NodeGroupFilter) GetExcludeAll

func (f *NodeGroupFilter) GetExcludeAll() bool

GetExcludeAll returns whether all nodegroups will be excluded

func (*NodeGroupFilter) LogInfo

func (f *NodeGroupFilter) LogInfo(cfg *api.ClusterConfig)

LogInfo prints out a user-friendly message about how filter was applied

func (*NodeGroupFilter) Match

func (f *NodeGroupFilter) Match(ngName string) bool

Match decides whether the given nodegroup is considered included by this filter. It takes into account not only the inclusion and exclusion rules (globs) but also the modifiers onlyRemote and onlyLocal.

func (*NodeGroupFilter) SetExcludeAll

func (f *NodeGroupFilter) SetExcludeAll(excludeAll bool)

SetExcludeAll sets the ExcludeAll flag in the filter so that no nodegroups are matched

func (*NodeGroupFilter) SetOnlyLocal

func (f *NodeGroupFilter) SetOnlyLocal(ctx context.Context, eksAPI awsapi.EKS, lister StackLister, clusterConfig *api.ClusterConfig) error

SetOnlyLocal uses StackLister to list existing nodegroup stacks and configures the filter to only include the nodegroups that don't exist in the cluster already. Note: they are present in the config file but not in the cluster. This is used by the create nodegroup command

func (*NodeGroupFilter) SetOnlyRemote

func (f *NodeGroupFilter) SetOnlyRemote(ctx context.Context, eksAPI awsapi.EKS, lister StackLister, clusterConfig *api.ClusterConfig) error

SetOnlyRemote uses StackLister to list existing nodegroup stacks and configures the filter to exclude nodegroups already defined in the config file. It will include the

nodegroups that exist in the cluster but not in the config

type NodegroupFilter added in v0.53.0

type NodegroupFilter interface {
	SetOnlyLocal(ctx context.Context, eksAPI awsapi.EKS, lister StackLister, clusterConfig *api.ClusterConfig) error
	Match(ngName string) bool
	LogInfo(cfg *api.ClusterConfig)
}

NodegroupFilter is an interface that holds filter configuration

type StackLister added in v0.53.0

type StackLister interface {
	ListNodeGroupStacks(ctx context.Context) ([]manager.NodeGroupStack, error)
}

StackLister lists nodegroup stacks

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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