has anyone got any pointers on installing Helm cha...
# general
d
has anyone got any pointers on installing Helm charts into non-default/current namespaces? I’ve tried passing a custom provider to Helm as mentioned here, but it gets ignored https://github.com/pulumi/pulumi-kubernetes/issues/217#issuecomment-504160101
c
Yes, we use a transformation to handle it.
Copy code
new k8s.helm.v2.Chart(config.project, {
  chart: 'stable/jenkins',
  version: '1.3.3',
  namespace: namespace.metadata.name,
  values: {
    master: {
      serviceType: 'ClusterIP',
    }
  },
  transformations: [
    (resource: any) => {
      resource.metadata.namespace = namespace.metadata.name;

      // This fixes the test failing
      if (resource.kind == 'Pod') {
        resource.metadata.annotations = {
          '<http://sidecar.istio.io/inject|sidecar.istio.io/inject>': 'false'
        };
      }
    }
  ]
});
d
I’m a bit wary of that, in case a chart uses non-cluster-scoped resources
c
It hasn’t seemed to have broken anything for us, but I get your worry. I think there are some other more complicated transformations that do the same thing, but ignore those types of resources
It’s the only solution that I am aware of.
The proper solution though is to submit a PR against the chart and have them add the namespace explicitly.
Tiller is going away, so they will need it anyways I believe. I’ve seen several charts accept these changes.
d
ok, cheers - I don’t get why setting the namespace on the k8s provider doesn’t work though 🤔
g
@damp-room-71337 Would you mind filing an issue with details on the provider namespace not working for you? https://github.com/pulumi/pulumi-kubernetes/issues/new
d
sure
🙏 1
g
Updated the ticket with a resolution. This chart was already fixed upstream, so you just have to set the
namespace
parameter on the chart to get the behavior you want
d
Yep just saw - that’s a fix for this specific chart, but I’d guess that there’s a general issue with Helm not respecting the k8s provider’s namespace?
g
Right. We don’t use Tiller, so some charts don’t work out of the box. Best thing is to fix the chart upstream, but the other ways can be used to work around in the meantime
To clarify, the provider namespace flag is a default, not an override, so the chart’s value was taking precedence here
d
fair enough - I know it’s not Pulumi’s doing, but this is pretty hard to work with at the moment. The workarounds detailed here don’t always work for all Helm charts https://github.com/pulumi/pulumi-kubernetes/issues/217#issuecomment-504160101
g
If you find specific cases that are confusing, please open an issue. We’re trying to make it as easy as possible, but it’s hard given the variety of approaches taken by helm charts
Since Tiller is going away with Helm 3, I’d expect the namespace issue to get better over time