Skip to content
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 resources to be created in controller namespace #174

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adriansuarez
Copy link

This change allows the Terraform task pod and other resources to be created in the namespace that the controller is running in.

This should address #173.

This change allows the Terraform task pod and other resources to be
created in the namespace that the controller is running in.
Always include both resourceName and resourceNamespace in selector.
Previously it was being omitted for backwards-compatibility, but that
creates problems when there are Terraform resources in different
namespaces and also in the same namespace as the controller, both having
the same name.

Just assume that any old resources would have been cleaned up before
upgrading, and if not, force the user to manually delete them.
@isaaguilar
Copy link
Collaborator

isaaguilar commented Oct 22, 2024

This is great. I understand the security implication here. And I really appreciate the time and effort in this PR!

One question, shouldn't the controller be namespaced in such a way so that is only watches and acts on a single namespace? I feel a namespaced controller is really the heart of the conversation. If the controller is limited to a namespace, it should not create, or even be aware, of resources outside of its own namespace. Instead, namespace the controller, and add additional controllers to different namespaces as needed.

I personally use the tf-operator in a larger platform and name-spacing is a little harder to manage, but I can definitely see why it would be appealing.

I love the helper functions and the label prefix, these were much needed improvements! But what do you think of having the option to make the controller "namespace" aware instead or forcing all the tasks into a namespace?

@adriansuarez
Copy link
Author

I have to refresh my memory on this, but I think the motivation for this is that my organization's policy was restricting cluster-scoped access to resources like Secrets and ConfigMaps, which is a security concern to grant at a wide scope, but it was not a security concern to grant cluster-scoped access to CRDs owned by a controller.

The deployment scenario that this change was supposed to enable is one where a particular service owner in a multi-tenant cluster would have its own namespace (separate from the Terraform controller), and would be able to make the Terraform controller provision resources on its behalf by creating a Terraform CR in its own namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants