carvel-dev / carvel-dev/kapp-controller

Helm template Release.namespace resolution fails on remote clusters

Open
#585 5 comments 0 reactions 0 assignees View on GitHub
bug carvel-accepted priority/unprioritized-backlog
Dominant language
Go
Stars
323
Forks
127
Avg merge
2d 16h
Merged PRs (30d)
4

Description

**What steps did you take:**
Deploy a Carvel application with `helmTemplate` approach in a remote target cluster has a misconfigured namespace.

**What happened:**
We created a Carvel package using the `helmTemplate` feature for Bitnami Cassandra. This Helm chart uses the namespace to [create specific service names](https://github.com/bitnami/charts/blob/bf7830e33c5633914ec3e5c81eb20995b9a87def/bitnami/cassandra/templates/_helpers.tpl#L52). The Release.namespace is a [built-in object](https://helm.sh/docs/chart_template_guide/builtin_objects/) in Helm, in this specific case the Helm chart uses this variable.

Whenever we deploy the Carvel package in the same cluster that `kapp-controller` is running, the application works properly. The service uses the proper namespace for the service name and for the configuration of the application.

If we deploy the application in a remote cluster, different cluster that `kapp-controller` is running. The resolution of the Release.namespace is different and the service name does not match with the specified namespace into the `PackageInstall` CR. In this case the pods are looking for a service name that does not exist:

`Seed provider couldn't lookup host cassandra-0.cassandra-headless.deployment-service.svc.cluster.local`
Meanwhile the pods configuration contain:
`/etc/hosts
192.168.63.24 cassandra-0.cassandra-headless.target-namespace.svc.cluster.local cassandra-0`

The workaround for this is to specify the `namespace` into the `Package` CR into the `helmTemplate` section. But that is not ideal, users should be able to specify the target namespace into the `PackageInstall` CR.

**What did you expect:**
Deploying a Carvel package in a remote cluster should use the same namespace to resolve the Helm chart variables.

**Environment:**

- kapp Controller version): 0.32.0
- ghcr.io/vmware-tanzu/carvel-kapp-controller@sha256:8e56eb65782697dd7aef3d9ab1df3294ade42ca41c5ecb38ff2cd579b3221d82
- Kubernetes version (use `kubectl version`): 1.22.5 (TKG v1.5.1)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.