Skip to content

Commit

Permalink
Merge pull request #3843 from dlipovetsky/dlipovetsky/fix-sg-override…
Browse files Browse the repository at this point in the history
…-wording

fix: Replace misleading wording used for security group overrides
  • Loading branch information
k8s-ci-robot authored Nov 14, 2022
2 parents 82a3a5b + 6a92981 commit 8dca968
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
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.
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

0 comments on commit 8dca968

Please sign in to comment.