Skip to main content

Deleting Helm Chart Default Values

10 min

Helm charts commonly provide default values in values.yaml, and many chart templates guard fields with truthy checks like {{- if .Values.foo }}.

The standard way to remove one of those defaults is to set the value to null — the equivalent of helm install --set foo=null on the Helm CLI. In this guide you'll see how to do that from every Pulumi language, including the valueYamlFiles approach required outside of TypeScript.

What you'll learn
  • How to remove a Helm chart default value by setting it to null
  • How to use valueYamlFiles to delete defaults from Python, Go, C#, Java, and YAML
Prerequisites

Helm charts commonly provide default values in values.yaml, and many chart templates guard fields with truthy checks like {{- if .Values.foo }}. The standard way to remove one of those defaults is to set the value to null — the equivalent of helm install --set foo=null on the Helm CLI.

TypeScript: set the key to null in the inline values map#

In TypeScript this is straightforward — set the key to null in the values map and it flows through to Helm:

import * as k8s from "@pulumi/kubernetes";
const nginx = new k8s.helm.v3.Release("nginx", {
chart: "nginx",
repositoryOpts: {
repo: "https://charts.bitnami.com/bitnami",
},
values: {
containerPorts: {
http: null,
},
},
});

Other SDKs: use valueYamlFiles#

Inline null in the values map only works from TypeScript — other Pulumi SDKs strip null map values before they reach the provider. The valueYamlFiles path avoids this because the file content is shipped as a Pulumi Asset and parsed on the provider side. Put the explicit null in a yaml file and reference it:

overrides.yaml
containerPorts:
http: null
import pulumi
from pulumi_kubernetes.helm.v3 import Release, ReleaseArgs, RepositoryOptsArgs
nginx = Release(
"nginx",
ReleaseArgs(
chart="nginx",
repository_opts=RepositoryOptsArgs(
repo="https://charts.bitnami.com/bitnami",
),
value_yaml_files=[pulumi.FileAsset("./overrides.yaml")],
),
)

On the next pulumi up, the http default from the chart’s values.yaml is dropped and the containerPorts block is rendered without it.

Next steps#

Related

The infrastructure as code platform for any cloud.