pulumi-kubernetes icon indicating copy to clipboard operation
pulumi-kubernetes copied to clipboard

Empty array value still ignored in Helm Chart

Open sebastien-prudhomme opened this issue 1 year ago • 6 comments

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).

sebastien-prudhomme avatar Dec 26 '23 18:12 sebastien-prudhomme

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.

sebastien-prudhomme avatar Dec 26 '23 18:12 sebastien-prudhomme

FWIW- this happens on YAML as well. Workaround I found was quotes:

- labels:
    requestAddr: ''
    requestCode: ''
    requestMethod: ''
    requestScheme: ''
    requestTlsVersion: ''

nstires-ctgx avatar Dec 27 '23 04:12 nstires-ctgx

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.

mjeffryes avatar Jan 02 '24 22:01 mjeffryes

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.

mattfysh avatar Jan 31 '24 07:01 mattfysh

This is affecting us too from being able to deploy a helm chart as the null value is needed, passing '' does not work.

will3942 avatar Mar 20 '24 10:03 will3942

Possible duplicate: https://github.com/pulumi/pulumi-kubernetes/issues/2034

EronWright avatar Mar 29 '24 23:03 EronWright