filter

package
v0.176.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessEntry added in v0.167.0

type AccessEntry struct {
	Lister      AccessEntryLister
	ClusterName string
}

AccessEntry filters out existing access entry resources.

func (*AccessEntry) FilterOutExistingStacks added in v0.167.0

func (a *AccessEntry) FilterOutExistingStacks(ctx context.Context, accessEntries []api.AccessEntry) ([]api.AccessEntry, error)

FilterOutExistingStacks returns a set of api.AccessEntry resources that do not have a corresponding stack.

type AccessEntryLister added in v0.167.0

type AccessEntryLister interface {
	// ListAccessEntryStackNames lists stack names for all access entries in the specified cluster.
	ListAccessEntryStackNames(ctx context.Context, clusterName string) ([]string, error)
}

An AccessEntryLister lists access entries.

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.Set[string], sets.Set[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 {
	ListNodeGroupStacksWithStatuses(ctx context.Context) ([]manager.NodeGroupStack, error)
}

StackLister lists nodegroup stacks

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.
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