pulumi-kubernetes
pulumi-kubernetes copied to clipboard
Empty array value still ignored in Helm Chart
What happened?
I'm trying to empty a list in the Velero Helm chart.
I expect that the resulting value used to instanciate the Helm chart is also an empty list. Nothing is take into account by the Pulumi provider, even when I use the "allow_null_values" parameter.
I've tried to replace the empty list by None (Python) or null (Typescript) without any success.
The result is that the corresponding YAML key is ignored by Pulumi and the value configured in the Helm chart is always used.
Example
I've tested this Python code:
import pulumi
import pulumi_kubernetes as kubernetes
velero_ns = kubernetes.core.v1.Namespace(
"velero",
metadata=kubernetes.meta.v1.ObjectMetaArgs(
name="velero"
)
)
velero = kubernetes.helm.v3.Release(
"velero",
allow_null_values=True,
chart="velero",
name="velero",
namespace=velero_ns.metadata.name,
repository_opts=kubernetes.helm.v3.RepositoryOptsArgs(
repo="https://vmware-tanzu.github.io/helm-charts/",
),
values={
"configuration": {
"backupStorageLocation": [],
"volumeSnapshotLocation": []
}
},
version="5.2.0"
)
and also this Typescript code:
import * as pulumi from "@pulumi/pulumi";
import * as kubernetes from "@pulumi/kubernetes";
const veleroNs = new kubernetes.core.v1.Namespace("velero", {metadata: {
name: "velero",
}});
const velero = new kubernetes.helm.v3.Release("velero", {
chart: "velero",
allowNullValues: true,
name: "velero",
namespace: veleroNs.metadata.name,
repositoryOpts: {
repo: "https://vmware-tanzu.github.io/helm-charts/",
},
values: {
configuration: {
backupStorageLocation: [],
volumeSnapshotLocation: [],
},
},
version: "5.2.0",
});
Output of pulumi about
CLI
Version 3.99.0
Go Version go1.21.5
Go Compiler gc
Plugins
NAME VERSION
kubernetes 4.6.1
python unknown
Host
OS ubuntu
Version 22.04
Arch x86_64
This project is written in python: executable='/usr/bin/python3' version='3.10.12'
Current Stack: organization/pulumi-bug/dev
TYPE URN
pulumi:pulumi:Stack urn:pulumi:dev::pulumi-bug::pulumi:pulumi:Stack::pulumi-bug-dev
pulumi:providers:kubernetes urn:pulumi:dev::pulumi-bug::pulumi:providers:kubernetes::default_4_6_1
kubernetes:core/v1:Namespace urn:pulumi:dev::pulumi-bug::kubernetes:core/v1:Namespace::velero
kubernetes:helm.sh/v3:Release urn:pulumi:dev::pulumi-bug::kubernetes:helm.sh/v3:Release::velero
Found no pending operations associated with dev
Backend
Name flow
URL file://~
User sebastien
Organizations
Token type personal
Dependencies:
NAME VERSION
pip 23.3.2
pulumi-kubernetes 4.6.1
setuptools 69.0.3
wheel 0.42.0
Pulumi locates its logs in /tmp by default
Additional context
I've found this same bug here #2089.
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
Here https://github.com/pulumi/pulumi-kubernetes/issues/2622#issuecomment-1793156274 @EronWright seems to confirm the bug.
My workaround for now is to use the false boolean instead of the empty list.
FWIW- this happens on YAML as well. Workaround I found was quotes:
- labels:
requestAddr: ''
requestCode: ''
requestMethod: ''
requestScheme: ''
requestTlsVersion: ''
Thanks for reporting this @sebastien-prudhomme and for sharing your workaround. This is an awkward usability issue, we'll keep investigating to see if we can improve it.
I have a similar issue, I'm trying to install the latest opentelemetry collector and null's are significant in the values tree
I'm using the nodejs sdk, have set allowNullValues: true and upgraded to the latest provider, but the nulls are still being ignored. Checking the stack's state after a deploy confirms this.
This is affecting us too from being able to deploy a helm chart as the null value is needed, passing '' does not work.
Possible duplicate: https://github.com/pulumi/pulumi-kubernetes/issues/2034