4

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.

fabs
  • 77
  • 1
  • 1
  • 13
  • 1
    what happens if you set `"prometheus": pulumi.String("null"),` – runwuf Sep 29 '22 at 05:13
  • 1
    @fabs please can you share [`MWE`](https://stackoverflow.com/help/minimal-reproducible-example) – Chandan Sep 29 '22 at 05:16
  • @Chandan I have added a MWE which pointed me to the issue. The custom abstraction layer for the helm charts wasn`t handling the config correctly. I updated the quesstion to include the MWE and its working as expected – fabs Sep 29 '22 at 10:23

1 Answers1

1

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

fabs
  • 77
  • 1
  • 1
  • 13