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: Replace misleading wording used for security group overrides #3843

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
2 changes: 1 addition & 1 deletion pkg/cloud/scope/managedcontrolplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (s *ManagedControlPlaneScope) SecondaryCidrBlock() *string {
return s.ControlPlane.Spec.SecondaryCidrBlock
}

// SecurityGroupOverrides returns the security groups that are overridden in the ControlPlane spec.
// SecurityGroupOverrides returns the security groups that are overrides in the ControlPlane spec.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// SecurityGroupOverrides returns the security groups that are overrides in the ControlPlane spec.
// SecurityGroupOverrides returns the security groups that are used as overrides in the ControlPlane spec.

Copy link
Member

Choose a reason for hiding this comment

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

Can be taken up in next PR

func (s *ManagedControlPlaneScope) SecurityGroupOverrides() map[infrav1.SecurityGroupRole]string {
return s.ControlPlane.Spec.NetworkSpec.SecurityGroupOverrides
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cloud/scope/sg.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type SGScope interface {
// SecurityGroups returns the cluster security groups as a map, it creates the map if empty.
SecurityGroups() map[infrav1.SecurityGroupRole]infrav1.SecurityGroup

// SecurityGroupOverrides returns the security groups that are overridden in the cluster spec
// SecurityGroupOverrides returns the security groups that are used as overrides in the cluster spec
SecurityGroupOverrides() map[infrav1.SecurityGroupRole]string

// VPC returns the cluster VPC.
Expand Down
8 changes: 4 additions & 4 deletions pkg/cloud/services/securitygroup/securitygroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (s *Service) ReconcileSecurityGroups() error {
continue
}

if !s.securityGroupIsOverridden(existing.ID) {
if !s.securityGroupIsAnOverride(existing.ID) {
// Make sure tags are up to date.
if err := wait.WaitForWithRetryable(wait.NewBackoff(), func() (bool, error) {
buildParams := s.getSecurityGroupTagParams(existing.Name, existing.ID, role)
Expand All @@ -140,8 +140,8 @@ func (s *Service) ReconcileSecurityGroups() error {
sg := s.scope.SecurityGroups()[i]
s.scope.Debug("second pass security group reconciliation", "group-id", sg.ID, "name", sg.Name, "role", i)

if s.securityGroupIsOverridden(sg.ID) {
// skip rule/tag reconciliation on security groups that are overridden, assuming they're managed by another process
if s.securityGroupIsAnOverride(sg.ID) {
// skip rule/tag reconciliation on security groups that are overrides, assuming they're managed by another process
continue
}

Expand Down Expand Up @@ -188,7 +188,7 @@ func (s *Service) ReconcileSecurityGroups() error {
return nil
}

func (s *Service) securityGroupIsOverridden(securityGroupID string) bool {
func (s *Service) securityGroupIsAnOverride(securityGroupID string) bool {
for _, overrideID := range s.scope.SecurityGroupOverrides() {
if overrideID == securityGroupID {
return true
Expand Down
4 changes: 2 additions & 2 deletions pkg/cloud/services/securitygroup/securitygroups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func TestReconcileSecurityGroups(t *testing.T) {
},
},
{
name: "all overridden, do not tag",
name: "all overrides defined, do not tag",
input: &infrav1.NetworkSpec{
VPC: infrav1.VPCSpec{
ID: "vpc-securitygroups",
Expand Down Expand Up @@ -412,7 +412,7 @@ func TestDeleteSecurityGroups(t *testing.T) {
wantErr bool
}{
{
name: "do not delete overridden security groups",
name: "do not delete security groups provided as overrides",
input: &infrav1.NetworkSpec{
VPC: infrav1.VPCSpec{
ID: "vpc-securitygroups",
Expand Down