Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: AWSNodeTemplate controller should not produce an error if no securityGroupSelector is specified #3437

Merged
merged 6 commits into from
Feb 22, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkg/providers/securitygroup/securitygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewProvider(ec2api ec2iface.EC2API) *Provider {
return &Provider{
ec2api: ec2api,
cm: pretty.NewChangeMonitor(),
// TODO: Remove cahce for v1bata1, utlize resolved security groups from the AWSNodeTemplate.status
// TODO: Remove cache for v1beta1, utilize resolved security groups from the AWSNodeTemplate.status
cache: cache.New(awscache.DefaultTTL, awscache.DefaultCleanupInterval),
}
}
Expand All @@ -55,7 +55,13 @@ func (p *Provider) List(ctx context.Context, nodeTemplate *v1alpha1.AWSNodeTempl
p.Lock()
defer p.Unlock()
// Get SecurityGroups
securityGroups, err := p.getSecurityGroups(ctx, p.getFilters(nodeTemplate))
// TODO: When removing custom launchTemplates for v1beta1, security groups will be required.
// The check will not be necessary
filters := p.getFilters(nodeTemplate)
engedaam marked this conversation as resolved.
Show resolved Hide resolved
if len(filters) == 0 {
engedaam marked this conversation as resolved.
Show resolved Hide resolved
return []string{}, nil
}
securityGroups, err := p.getSecurityGroups(ctx, filters)
if err != nil {
return nil, err
}
Expand Down