Skip to content

Commit 6a92981

Browse files
committed
fix: Replace misleading wording used for security group overrides
The wording "overridden" is misleading. In every case where the wording is used to reference a security group, the security group is being overridden. Instead, it is the security group provided as an override.
1 parent ca53d74 commit 6a92981

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

pkg/cloud/scope/managedcontrolplane.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (s *ManagedControlPlaneScope) SecondaryCidrBlock() *string {
193193
return s.ControlPlane.Spec.SecondaryCidrBlock
194194
}
195195

196-
// SecurityGroupOverrides returns the security groups that are overridden in the ControlPlane spec.
196+
// SecurityGroupOverrides returns the security groups that are overrides in the ControlPlane spec.
197197
func (s *ManagedControlPlaneScope) SecurityGroupOverrides() map[infrav1.SecurityGroupRole]string {
198198
return s.ControlPlane.Spec.NetworkSpec.SecurityGroupOverrides
199199
}

pkg/cloud/scope/sg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type SGScope interface {
3131
// SecurityGroups returns the cluster security groups as a map, it creates the map if empty.
3232
SecurityGroups() map[infrav1.SecurityGroupRole]infrav1.SecurityGroup
3333

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

3737
// VPC returns the cluster VPC.

pkg/cloud/services/securitygroup/securitygroups.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (s *Service) ReconcileSecurityGroups() error {
119119
continue
120120
}
121121

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

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

@@ -188,7 +188,7 @@ func (s *Service) ReconcileSecurityGroups() error {
188188
return nil
189189
}
190190

191-
func (s *Service) securityGroupIsOverridden(securityGroupID string) bool {
191+
func (s *Service) securityGroupIsAnOverride(securityGroupID string) bool {
192192
for _, overrideID := range s.scope.SecurityGroupOverrides() {
193193
if overrideID == securityGroupID {
194194
return true

pkg/cloud/services/securitygroup/securitygroups_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func TestReconcileSecurityGroups(t *testing.T) {
247247
},
248248
},
249249
{
250-
name: "all overridden, do not tag",
250+
name: "all overrides defined, do not tag",
251251
input: &infrav1.NetworkSpec{
252252
VPC: infrav1.VPCSpec{
253253
ID: "vpc-securitygroups",
@@ -412,7 +412,7 @@ func TestDeleteSecurityGroups(t *testing.T) {
412412
wantErr bool
413413
}{
414414
{
415-
name: "do not delete overridden security groups",
415+
name: "do not delete security groups provided as overrides",
416416
input: &infrav1.NetworkSpec{
417417
VPC: infrav1.VPCSpec{
418418
ID: "vpc-securitygroups",

0 commit comments

Comments
 (0)