-
Notifications
You must be signed in to change notification settings - Fork 260
Prevent Namespace Race #461
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
7ce6d32 to
8752755
Compare
ca08403 to
8752755
Compare
…where entries don't get added after failing to append non-existing namespace to all-namespaces.
8752755 to
63dd9d5
Compare
f2e306d to
82784c2
Compare
| return nil | ||
| } | ||
|
|
||
| // AddNamespaceWithLock acquires NetworkPolicyManager lock before adding namespace to ipset |
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 think a cleaner way to do this is to unlock & lock in the caller instead of having this function.
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.
AddNamespace used to take a bool to determine that, but having every signature with a bool seemed a bit like an antipattern, but it can be changed back
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.
That was the pattern I had it in before. And I don't feel strongly about either to change it back and forth
What this PR does / why we need it:
Adding namespace to npMgr if it doesn't exist. This fixes reboot bug where entries don't get added after failing to append non-existing namespace to all-namespaces.
When NPM reboots, namespace details do not always sync before policies and pods do. In those cases the namespace will need to be added before we proceed with add/update pod/networkpolicy workflow.