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

Revert "fix: adds deleteBastionSecurityGroup to DeleteBastion() [ off release branch ]" #88

Merged
merged 1 commit into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func (r *AWSManagedControlPlaneReconciler) reconcileNormal(ctx context.Context,
}

sgRoles := []infrav1.SecurityGroupRole{
infrav1.SecurityGroupBastion,
infrav1.SecurityGroupEKSNodeAdditional,
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cloud/services/ec2/bastion.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (s *Service) ReconcileBastion() error {
return nil
}

// DeleteBastion deletes the Bastion instance and related security groups
// DeleteBastion deletes the Bastion instance
func (s *Service) DeleteBastion() error {
instance, err := s.describeBastionInstance()
if err != nil {
Expand Down
13 changes: 4 additions & 9 deletions pkg/cloud/services/securitygroup/securitygroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ func (s *Service) ReconcileSecurityGroups() error {
existing, ok := sgs[*sg.GroupName]

if !ok {
// if it is disabled and the role is bastion, skip
if !s.scope.Bastion().Enabled && role == "bastion" {
break
} else if err := s.createSecurityGroup(role, sg); err != nil {
if err := s.createSecurityGroup(role, sg); err != nil {
return err
}

Expand Down Expand Up @@ -465,11 +462,9 @@ func (s *Service) getSecurityGroupIngressRules(role infrav1.SecurityGroupRole) (
}
return append(cniRules, rules...), nil
case infrav1.SecurityGroupEKSNodeAdditional:
if !s.scope.Bastion().Enabled {
return infrav1.IngressRules{
s.defaultSSHIngressRule(s.scope.SecurityGroups()[infrav1.SecurityGroupBastion].ID),
}, nil
}
return infrav1.IngressRules{
s.defaultSSHIngressRule(s.scope.SecurityGroups()[infrav1.SecurityGroupBastion].ID),
}, nil
case infrav1.SecurityGroupAPIServerLB:
return infrav1.IngressRules{
{
Expand Down