Skip to content
Draft
Changes from all 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
8 changes: 6 additions & 2 deletions pkg/cloud/services/securitygroup/securitygroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ func (s *Service) ReconcileSecurityGroups() error {
// skip rule reconciliation, as we expect the in-cluster cloud integration to manage them
continue
}
if sg.Name == "default" {
// skip rule reconciliation, as default SG group is already handled by revokeIngressAndEgressRulesFromVPCDefaultSecurityGroup
continue
}
Comment on lines +163 to +166
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This special handling could lead to more bugs. For example, authorizeSecurityGroupIngressRules is still below and is also exempted with this continue statement.

Can we instead rather fix this by ignoring the NotFound error where it happens?

(We're also observing this annoying problem for non-EKS clusters, by the way.)

current := sg.IngressRules

specRules, err := s.getSecurityGroupIngressRules(role)
Expand Down Expand Up @@ -516,8 +520,8 @@ func (s *Service) revokeSecurityGroupIngressRules(id string, rules infrav1.Ingre
rule := rules[i]
input.IpPermissions = append(input.IpPermissions, *ingressRuleToSDKType(s.scope, &rule))
}

if _, err := s.EC2Client.RevokeSecurityGroupIngress(context.TODO(), input); err != nil && !awserrors.IsPermissionNotFoundError(errors.Cause(err)) {
_, err := s.EC2Client.RevokeSecurityGroupIngress(context.TODO(), input)
if err != nil && !awserrors.IsPermissionNotFoundError(errors.Cause(err)) {
Comment on lines -519 to +524
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No difference here, or am I overlooking something?

record.Warnf(s.scope.InfraCluster(), "FailedRevokeSecurityGroupIngressRules", "Failed to revoke security group ingress rules %v for SecurityGroup %q: %v", rules, id, err)
return errors.Wrapf(err, "failed to revoke security group %q ingress rules: %v", id, rules)
}
Expand Down