mittwald / kubernetes-replicator

Kubernetes controller for synchronizing secrets & config maps across namespaces
Apache License 2.0
866 stars 100 forks source link

Add support for enabling/disabling the replication of object types #335

Closed aljoshare closed 4 months ago

aljoshare commented 5 months ago

This PR adds the support for enabling or disabling the replication of object types and strengthens the principle of least privilege. For example, you can now disable the replication of roles, role bindings or service accounts if thats not needed for your use case.

Fixes https://github.com/mittwald/kubernetes-replicator/issues/284

aljoshare commented 5 months ago

@martin-helmich For now, I added the flags as examples to the args in the helm values. I could also introduce separate values and toggle also the RBAC (as you wrote in the issue). Should I do that or leave it like this? 😊

aljoshare commented 4 months ago

@martin-helmich I added a separate config for the toggles, added them directly to the deployment and refactored the RBAC a little to make it more readable with flow control.

There is one thing which is maybe not backward compatible: If someone copied the args: [] instead of just relying on the default value, it would break now. Do you think we should handle this case by adding more complexity or leave it like this because it's not a good idea to copy defaults anyway?

aljoshare commented 4 months ago

@martin-helmich Ping 😇

martin-helmich commented 4 months ago

If someone copied the args: [] instead of just relying on the default value, it would break now. Do you think we should handle this case by adding more complexity or leave it like this because it's not a good idea to copy defaults anyway?

I'm not sure if this is actually breaking; IIRC, with should not evaluate to true with an empty slice. In any case, I think the probability that a user would have explicitly overridden args: [] is slim. I'll keep an ear open if any feedback comes in on this.

aljoshare commented 4 months ago

Agh, apologies. 😱🙏 Looks good to me now. 👍

No problem 😊 Thank you!