-
Notifications
You must be signed in to change notification settings - Fork 1.1k
helm-operator: install resources to different namespace than HelmRelease itself #2128
Comments
What is the reason you want to put your release somewhere else than where your |
This has serious implication with GC enabled, deleting a namespace where the HelmRelease is will delete the release from another namespace. I'm personally against this as it conflicts with how Kubernetes CRD are intended to work, a custom resources if it's scoped to a namespace should trigger operations only in that namespace. |
the main use case we have regarding this issue is next: so basically, in admin repo we have
and main flux in kube-system will apply those resources without manual human |
Ok so put the HelmRelease file next to the namespace definition. |
@stefanprodan I've tried, but not successful. so in main admin repo I have two files, right?
what namespace should I specify in that crd resource for flux helmrelease?
|
In kube-system you should have Flux, Helm Operator and Tiller running. Repo structure: team1 dir:
team2 dir:
The teams Flux HelmRelease should not contain the Helm Operator. |
the main problem is that in those namespaces we want to have it's own tillers and helm-operators installed and our helm-operator in kube-system is only limited to watching crd in kube-system namespace. this way we can give access to team only for team1 namespace (ns admin, for example). |
You can deploy two Helm operators in your |
I don't see how this can be done with HelmReleases since it's a chicken-egg situation. In your admin repo I would place yamls for Flux, Helm Operator and Tiller. Your dev teams can use HelmReleases but not the admins. |
This is not going to happen as a feature as described in the title. I've made it a question about how to construct the system described in the comments. @AndriiOmelianenko Do you feel that you have enough advice to make progress? |
sorry guys, I'm still not getting it how to set up it, when I have tiller in each namespace (in kube-system, in team1, in team2). if I use only one helm-operator in kube-system (and set |
@AndriiOmelianenko the solution I proposed above boils down to this: the admin git repository can't contain HelmReleases for installing Flux in a different namespaces. Instead of using HelmReleases you can put the YAMLs generated with |
Linking in a discussion from Slack where I had a similar request - https://weave-community.slack.com/archives/C4U5ATZ9S/p1565024811282000 Essentially, I want to have a What I want to accomplish is similar to the Out of curiosity, why would it be surprising that deleting the namespace containing the |
@stefanprodan I don't think this is a strict rule. There are other useful controllers that break the rule on purpose.
"IngressRoute Delegation" allows administrators to enforce policies about how domains are routed in a target namespace from the admin namespace. This allows others full control of the other objects in the target namespace while preventing the Ingress Controller from being misconfigured. I believe what @dcherman is asking for is a valid use-case that mirrors the same pattern.
In general, HelmReleases are simply used to instruct Helm to mutate its own storage backend. Helm uses that storage and manages its own GC for the Release's target namespace, so we shouldn't conflate the HelmRelease's namespace and the Releases's target namespace when talking about what affects k8s GC. It should be acknowledged that with the current helm-operator, hooked up to Tiller with a ClusterRoleBinding that has edit access, a HelmRelease can already easily breach the single-Namespace boundary. Setting the Release's target namespace to the HelmRelease object's namespace is a great and sensible default. |
Very well explained @stealthybox . I'm also interested in this enhancement. I'm currently working around it for the cluster infrastructure by using a helm-operator-controller that watches for namespace CRUDs and puts a helm-operator in each namespace for each infrastructure component that is namespace-isolated, barring exclusion by annotations. My CD pipelines create the namespace they are targeting and then drop the HelmRelease in, which is then picked up by the local helm-operator as soon as its up. Project/team namespaces are ignored by label selectors because they already get their own namespaced Tiller and helm-operator since they don't have access to the system Tiller. |
One edge case to adding this feature is that it's possible to create two different We could help prevent this by adding targetNamespace to the name. It's already possible to do this with flux right now by causing two |
Is it possible to detect that two different |
Oh nevermind, you can override |
It's really not possible since there are multiple datastores with differing ideas. Those separate tillers can have releases with the same name differing in charts or their target namespace. |
Helm 3 will store the Release CR in the target Namespace. |
I built in a safeguard for this, see: #2123 |
I'm still not quite getting one thing though: currently, I am already able to create resources in other namespace, by strictly hardcoding namespace in chart definition (or transforming it though so that means I'm already able to achieve my usecase with dirty workarounds in my own charts, but I can't do the same with public charts. it would be great if instead of using tricks - we would be able to use this helm feature of target namespace using |
Support different targetNamespace for HelmRelease #2128
Thanks @stefanprodan and @stealthybox. This will make configuring infrastructure components much cleaner for cluster operators. |
Describe the feature
When using plain helm to install resources, user can specify next:
--tiller-namespace
- namespace where the tiller is located.--namespace
- namespace where resources should be installed.so basically, when I want to use tiller in
kube-system
ns and install resources from chart to, let's say,development
ns, I can dohelm install --tiller-namespace kube-system --namespace development
.however, if I'm using helm-operator and flux, I don't see where can I do that.
I can only specify
namespace
forHelmRelease
resource, and all the things from my helm chart will be installed to the same ns where helmrelease is located.Expected behavior
Add possibility to configure
helm --namespace ...
feature, for example, user can specify separately namespace where tiller and helm-operator are located and separately namespace, where the resources should be installed:The text was updated successfully, but these errors were encountered: