Metriche repository
- Star
- (29.815 star)
- Metriche merge PR
- (Merge medio 40g 17h) (48 PR mergiate in 30 g)
Descrizione
What happened?
I am now getting errors such as the following:
> ~/code/helm/bin/helm install jesse .
Error: INSTALLATION FAILED: failed to create typed patch object (default/jesse-test; apps/v1, Kind=Deployment): .spec.template.spec.containers[name="test"].env: duplicate entries for key [name="SERVER_CONTEXT_PATH"]
Because there is a duplicate environment variable named SERVER_CONTEXT_PATH inside the manifest.
k8s in general allows you to specify duplicate environment variables. And when a duplicate env var exists, k8s will insert the bottom-most entry into the container.
Although it's seemingly a bit hacky to have duplicate env vars in the same manifest, users of the Camunda helm charts heavily rely on this behavior, because there are Spring settings that we set by default that we want users to be capable of overriding.
If this is expected behavior, can I get some advice on how I can change my helm charts to filter out the duplicates? I've tried a couple solutions, but they end up being really long and messy diffs.
What did you expect to happen?
I expected the manifest with the duplicate env var to be sent to the server.
How can we reproduce it (as minimally and precisely as possible)?
I created the following example helm chart to make it easy to test this: https://github.com/jessesimpson36/helm_error_charts/tree/main/9_duplicate_env
Clone the repo:
git clone https://github.com/jessesimpson36/helm_error_charts
cd helm_error_charts/9_duplicate_env
and install the chart:
helm install test ./
error:
> ~/code/helm/bin/helm install jesse .
Error: INSTALLATION FAILED: failed to create typed patch object (default/jesse-test; apps/v1, Kind=Deployment): .spec.template.spec.containers[name="test"].env: duplicate entries for key [name="SERVER_CONTEXT_PATH"]
Helm version
$ helm version
version.BuildInfo{Version:"v4.0+unreleased", GitCommit:"a75fcc29484730e14ba203f4593f81e6788b0152", GitTreeState:"dirty", GoVersion:"go1.25.3 X:nodwarf5", KubeClientVersion:"v1.34"}
Kubernetes version
$ kubectl version
> kubectl version
Client Version: v1.34.1
Kustomize Version: v5.7.1
Server Version: v1.34.1+k0s