-
Notifications
You must be signed in to change notification settings - Fork 189
Conversation
…nto autofixnetworkPolicy
…nto autofixnetworkPolicy
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 have 2 nitpicks and the issue that comments are deleted here in fixtures/namespace_missing_default_deny_netpol.yml
- - from:
- - namespaceSelector: # chooses all pods in namespaces labelled with team=operations
- matchLabels:
- team: operations
- podSelector: # chooses pods with type=monitoring
- matchLabels:
- type: monitoring
+ - from:
+ - namespaceSelector:
+ matchLabels:
+ team: operations
+ podSelector:
+ matchLabels:
+ type: monitoring
I am fine with fixing this issue in a different PR since it's about comments and not about autofixing NPs
@@ -159,6 +159,21 @@ func compareTextFiles(file1, file2 string) bool { | |||
return false | |||
} | |||
|
|||
f1stat, err := f1.Stat() |
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.
The problem is this doesn't give you any idea where they diff. The other code gave you a diff, this doesn't anymore.
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've moved the stat code to after the scan loop, now we'll get where the files don't match as well as it'd match length of both files at the end. Do you have a better way around this? One thing I thought of was to just set s1 to be the scanner of the larger file, but anyways if files dont match and we scan doesnt output an error but stat does we can imply that files don't match in length hence files missing some content after?
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's not the cleanest solution, but I think given how complicated a different solution would be this is I guess the best solution.
I am aware of this bug, I think it's just that we don't have support for namespaceSelector or from in our comment slices yet, I'll open an issue on this so I don't forget about it |
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.
Let's open an issue for the comment thing and then merge this :)
Description
Add autofix support for Network Policy auditing
For 🎩 try-
Add default egress/ingress deny network policy to namespace
#159 to be fixed later
Fixes (Autofix for Network Policies #156)
closes #156
Type of change
How Has This Been Tested?
Checklist: