-
Notifications
You must be signed in to change notification settings - Fork 106
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
allow multiple namespaces to be watched for policies #42
Conversation
Signed-off-by: Jan Willies <[email protected]>
reading #11 this seems a bit more work than this? |
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.
@janwillies this looks fine. I have one comment we should address but other than that, LGTM. Also, you'll need to sign-off on your changes before we can merge this.
source := cache.NewListWatchFromClient( | ||
client, | ||
"configmaps", | ||
namespace, |
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.
Users can deploy kube-mgmt with --policies=*
in which case configmaps in all namespaces will be replicated into OPA (this is used in conjunction with --require-policy-label` to filter configmaps.)
Could you add a flag to kube-mgmt so that users can tell it to watch specific namespaces? Otherwise this change will not be backwards compatible.
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'm a bit afraid that adding another parameter would maybe clutter the UI too much? Note that the help for --policies
currently says:
--policies stringSlice automatically load policies from these namespaces (default [opa,kube-federation-scheduling-policy])
Can we not simply parse the --policies=
parameter and in case of *
use v1.NamespaceAll
? Something like
if namespaces[0] == "*" {
namespaces[0] = v1.NamespaceAll
namespaces = namespaces[0:1]
}
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.
This looks fine. I would probably check whether the slice contained *
at all but this will work.
…lity Signed-off-by: Jan Willies <[email protected]>
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.
LGTM
source := cache.NewListWatchFromClient( | ||
client, | ||
"configmaps", | ||
namespace, |
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.
This looks fine. I would probably check whether the slice contained *
at all but this will work.
this fixes an inconsistency with the docs:
but
v1.NamespaceAll
was hardcoded