Search code examples
gokubernetes-helmpulumi

How to set null config values in helm charts via pulumi


I'm trying to configure a helm chart via pulumi and golang. According to the helm chart documentation default components can be removed by setting the config to null. I managed to set the desired config values for the helm chart in my pulumi script, but it's not possible to set config values to null.

Update:

It seems that the custom abstraction layer on top of the pulumi helm chart resource could not handle the config. I have added a minimal working example which uses the helm chart resource directly and its working as expected:

package main

import (
    helmv3 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := helmv3.NewChart(ctx, "otel-collect", helmv3.ChartArgs{
            Chart:   pulumi.String("opentelemetry-collector"),
            Version: pulumi.String("0.31.1"),
            FetchArgs: helmv3.FetchArgs{
                Repo: pulumi.String("https://open-telemetry.github.io/opentelemetry-helm-charts"),
            },
            Values: pulumi.Map{
                "fullnameOverride": pulumi.String("otel-collector"),
                "mode":             pulumi.String("deployment"),
                "config": pulumi.Map{
                    "receivers": pulumi.Map{
                        "jaeger": pulumi.Map{
                            "protocols": pulumi.Map{
                                "thrift_compact": nil,
                            },
                        },
                        "prometheus": nil,
                    },
                    "service": pulumi.Map{
                        "pipelines": pulumi.Map{
                            "metrics": nil,
                        },
                    },
                },
            },
        })
        if err != nil {
            return err
        }

        return nil
    })
}

In this scenario I want to set the prometheus config to null but when this chart is deployed the default values for prometheus are set. I have also tried "prometheus": pulumi.Any(nil), but this also does not change the config.


Solution

  • The issue was caused by an abstraction layer I put on top of the pulumi helm resources.