Closed AndreaVida closed 1 year ago
Hi @eshepelyuk,
about unit tests; my changes are only on the Helm Chart and I honestly have no idea on how unit tests can be done on it.
About implementation, I will try to not add a new value if possible and default behavior of watching current namespace is kept already. I am not 100% sure about the roles iteration stuff though, as the Go K8s library only supports one or all namespaces use cases and I am afraid the all case may require privileges to access all. Do you know more on this?
Hi @eshepelyuk,
about unit tests; my changes are only on the Helm Chart and I honestly have no idea on how unit tests can be done on it.
You should check
test/unit
folder and justfile recipetest-helm
About implementation, I will try to not add a new value if possible and default behavior of watching current namespace is kept already. I am not 100% sure about the roles iteration stuff though, as the Go K8s library only supports one or all namespaces use cases and I am afraid the all case may require privileges to access all. Do you know more on this?
I was referring to helm template not golang code.
I was referring to helm template not golang code.
Indeed, but if the library requires cluster-wide access when watching on Namespaces.All
it will not work without a ClusterRole
. That's the thing I am not sure about. Are you?
I was referring to helm template not golang code.
Indeed, but if the library requires cluster-wide access when watching on
Namespaces.All
it will not work without aClusterRole
. That's the thing I am not sure about. Are you?
But if watched namespaces has value of * -the ClusterRole should be gemerated by helm, as now.
I was referring to helm template not golang code.
Indeed, but if the library requires cluster-wide access when watching on
Namespaces.All
it will not work without aClusterRole
. That's the thing I am not sure about. Are you?But if watched namespaces has value of * -the ClusterRole should be gemerated by helm, as now.
Exactly, I was referring to the case when namespaces list length is > 1 but I just double checked golang code and seems like in that case one Informer instance is spawned for each namespace to watch; if that's the case then your proposal should work. Do you confirm this is how it works?
yes I do.
Thanks for the clarification! I will then work on discussed changes from now on.
Unfortunately there is a deeper issue.
ClusterRole is mandatory for k8s resources replication, so it must be created as soon as resource replication is required. rbac.extraRules
is intended for thus replication case only.
So much deeper changes required. The should be separate roles for policy \ data loading and for resource replication. My suggestion is to create two separate templates for them.
Support watching all namespaces (*) or only one with limited privileges (no ClusterRole and ClusterRoleBinding).
Default values are backward compatible.
Closes https://github.com/open-policy-agent/kube-mgmt/issues/212.