Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set Helm values to null in C# #3178

Open
mkuennek opened this issue Aug 20, 2024 · 5 comments
Open

Unable to set Helm values to null in C# #3178

mkuennek opened this issue Aug 20, 2024 · 5 comments
Labels
kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue

Comments

@mkuennek
Copy link

What happened?

I'm trying to install the OpenTelemetry collector using its Helm Chart. The chart's default values setup all three data processing pipelines(logs, traces and metrics). I only want to use traces. When installing this chart using the Helm CLI, I can achieve this by setting null values, e.g.

service:
  pipelines:
    metrics: null

When using the same values file as a FileAsset, setting it using Release.ValueYamlFiles null values are ignored.

I tried to do the same without the yaml and only using C# without any success. How can I achieve this behaviour with Pulumi?

Example

For a reproduction, see https://github.com/mkuennek/PulumiHelm.

Output of pulumi about

❯ pulumi about
running 'dotnet build -nologo .'
Determining projects to restore...

All projects are up-to-date for restore.

PulumiHelm -> /Users/mkuenneke/Sources/Github/PulumiHelm/bin/Debug/net8.0/PulumiHelm.dll

Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:00.59

'dotnet build -nologo .' completed successfully
Enter your passphrase to unlock config/secrets
(set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember):
Enter your passphrase to unlock config/secrets
CLI
Version 3.129.0
Go Version go1.22.6
Go Compiler gc

Plugins
KIND NAME VERSION
language dotnet unknown
resource kubernetes 4.17.1

Host
OS darwin
Version 14.6.1
Arch arm64

This project is written in dotnet: executable='/opt/homebrew/bin/dotnet' version='8.0.401'

Current Stack: organization/PulumiHelm/dev

TYPE URN
pulumi:pulumi:Stack urn:pulumi:dev::PulumiHelm::pulumi:pulumi:Stack::PulumiHelm-dev
pulumi:providers:kubernetes urn:pulumi:dev::PulumiHelm::pulumi:providers:kubernetes::default_4_17_1
kubernetes:helm.sh/v3:Release urn:pulumi:dev::PulumiHelm::kubernetes:helm.sh/v3:Release::otel-collector

Found no pending operations associated with dev

Backend
Name Michaels-MBP-2.localdomain
URL file://~
User mkuenneke
Organizations
Token type personal

Dependencies:
NAME VERSION
Pulumi 3.66.1
Pulumi.Kubernetes 4.17.1

Pulumi locates its logs in /var/folders/v0/cm8hmktx2rvb639v96scp0lw0000gn/T/ by default

Additional context

No response

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

@mkuennek mkuennek added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Aug 20, 2024
@blampe blampe added resolution/duplicate This issue is a duplicate of another issue and removed needs-triage Needs attention from the triage team labels Aug 20, 2024
@blampe
Copy link
Contributor

blampe commented Aug 20, 2024

I think this is a duplicate of #2034 and/or #2997.

The provider currently (unfortunately) ignores null values when handling inputs, which is significant for Helm values.

If you're using v3 Release you can try setting allowNullValues. You might also try metrics: {} but I can't guarantee either of those will work in this case.

As a way of back porting #2997 into v4 we could look into opt-in configuration to change the provider's behavior to respect nulls, but this is not a small change.

@mkuennek
Copy link
Author

Thanks for the feedback. I tried allowNullValues but unfortunately it does not help in this case. It only has an effect on value lists but not on dictionary type values.

Currently, I'm using Release v3 but I might give Chart v4 a try or manage this chart using the Helm CLI.

@blampe
Copy link
Contributor

blampe commented Aug 21, 2024

@mkuennek give allowNullValues and metrics: {} a try. IIRC it will respect the empty object but not null.

@shamil
Copy link

shamil commented Sep 3, 2024

In v3, we could use null on values to remove default values. However, when migrating to v4, this no longer works, and null no longer has any effect.

@mkuennek
Copy link
Author

mkuennek commented Sep 5, 2024

Thanks for the feedback. I tried allowNullValues but unfortunately it does not help in this case. It only has an effect on value lists but not on dictionary type values.

Currently, I'm using Release v3 but I might give Chart v4 a try or manage this chart using the Helm CLI.

Unfortunately not. I tried a Otel-collector values file like this:

mode: deployment
image:
  repository: otel/opentelemetry-collector-contrib
config:
  receivers:
    jaeger: {}
    prometheus: {}
    zipkin: {}

  service:
    pipelines:
      logs: {}
      metrics: {}
      traces:
        receivers:
          - otlp
        exporters:
          - debug
ports:
  jaeger-compact:
    enabled: false
  jaeger-thrift:
    enabled: false
  jaeger-grpc:
    enabled: false
  zipkin:
    enabled: false

The logs and metrics pipelines were still being created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/duplicate This issue is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants