Skip to content

Commit

Permalink
networkAcl update fails if ruleAction field has camelcase Allow/Deny (#…
Browse files Browse the repository at this point in the history
…169)


Issue [#1966](aws-controllers-k8s/community#1966)

Description of changes:
RCA and steps to reproduce are mentioned in the issue

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
nnbu authored Sep 19, 2024
1 parent 6e97d23 commit 73fe383
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions pkg/resource/network_acl/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"context"
"errors"
"strconv"
"strings"

ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log"
Expand Down Expand Up @@ -396,13 +397,28 @@ func containsEntry(

for _, e := range entryCollection {
delta := compareNetworkACLEntry(e, entry)

if len(delta.Differences) == 0 {
return true
if !delta.DifferentExcept("NetworkACLEntry.RuleAction") {
// Case insensitive comparison for RuleAction
if compareNetworkACLEntryAtRuleAction(e, entry) {
return true
}
}
}
return false
}

func compareNetworkACLEntryAtRuleAction(entry1 *svcapitypes.NetworkACLEntry, entry2 *svcapitypes.NetworkACLEntry) bool {
if entry1.RuleAction == nil && entry2.RuleAction == nil {
return true
}

if entry1.RuleAction == nil || entry2.RuleAction == nil {
return false
}

return strings.EqualFold(*entry1.RuleAction, *entry2.RuleAction)
}

func (rm *resourceManager) createEntry(
ctx context.Context,
r *resource,
Expand Down

0 comments on commit 73fe383

Please sign in to comment.