-
Notifications
You must be signed in to change notification settings - Fork 53
feat(NetworkACL): Filter Default Rules from Delta #252
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
Conversation
ddd6d44
to
acb2e30
Compare
/retest |
1 similar comment
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: michaelhtm, rushmash91 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
pkg/resource/network_acl/hooks.go
Outdated
) error { | ||
if r.ko.Spec.Entries != nil { | ||
if err := rm.syncEntries(ctx, r, nil); err != nil { | ||
if desired.ko.Spec.Entries != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if desired.ko.Spec.Entries != nil { | |
if len(desired.ko.Spec.Entries) > 0 { |
func customPreCompare( | ||
delta *ackcompare.Delta, | ||
a *resource, | ||
b *resource, | ||
) { | ||
a.ko.Spec.Entries = filterDefaultRules(a.ko.Spec.Entries) | ||
b.ko.Spec.Entries = filterDefaultRules(b.ko.Spec.Entries) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we filter rules both in preCompare and in syncEntries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was only needed during create, removing from sync and moving create to createEntries
pkg/resource/network_acl/hooks.go
Outdated
// During create latest is nil, just add the entries when sync is called via createEntries | ||
if latest == nil { | ||
toAdd = desired.ko.Spec.Entries | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why at this level of the code? also toAdd
is getting elements in L344. Maybe we need an if/else to make sure we're not executing unecessary logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just move out the creation from sync, don't think its a create idea.
acb2e30
to
2fdddf6
Compare
pkg/resource/network_acl/hooks.go
Outdated
if len(filteredEntries) > 0 { | ||
for _, entry := range filteredEntries { | ||
if err := rm.createEntry(ctx, desired, *entry); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(filteredEntries) > 0 { | |
for _, entry := range filteredEntries { | |
if err := rm.createEntry(ctx, desired, *entry); err != nil { | |
return err | |
} | |
} | |
} | |
for _, entry := range filteredEntries { | |
if err := rm.createEntry(ctx, desired, *entry); err != nil { | |
return err | |
} | |
} |
2fdddf6
to
ef2640b
Compare
/retest |
@rushmash91: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
fixes aws-controllers-k8s/community#2374
Description of changes:
createEntries
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.