Skip to content

Fix an error with Helm v4 #6013

@at-ishikawa

Description

@at-ishikawa

What happened?

When running kustomize build --enable-helm with Helm v4.0.0 installed, the command fails with an error about an unknown flag.

Error message:

Error: Error: unknown shorthand flag: 'c' in -c
: unable to run: 'helm version -c --short' with env=[HELM_CONFIG_HOME=/tmp/kustomize-helm-1488621679/helm HELM_CACHE_HOME=/tmp/kustomize-helm-1488621679/helm/.cache HELM_DATA_HOME=/tmp/kustomize-helm-1488621679/helm/.data] (is 'helm' installed?): exit status 1

This prevents kustomize from working with Helm v4.

Here is additional contexts:

What did you expect to happen?

The kustomize build --enable-helm command should work with Helm v4.0.0.

How can we reproduce it (as minimally and precisely as possible)?

Prerequisites

  1. Install Helm v4.0.0
  2. Install kustomize v5.8.0

Reproduction steps

1. Create a test kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

helmCharts:
- name: nginx
  repo: https://charts.bitnami.com/bitnami
  version: 18.2.6
  releaseName: test-nginx
  namespace: default
  includeCRDs: false
  valuesInline:
    replicaCount: 1

2. Ensure Helm v4 is in PATH:

$ helm version
version.BuildInfo{Version:"v4.0.0", GitCommit:"99cd1964357c793351be481d55abbe21c6b2f4ec", GitTreeState:"clean", GoVersion:"go1.25.3", KubeClientVersion:"v1.34"}

3. Run kustomize with --enable-helm:

$ kustomize build . --enable-helm

Expected output

apiVersion: v1
automountServiceAccountToken: false
kind: ServiceAccount
metadata:
  labels:
    app.kubernetes.io/instance: test-nginx
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: nginx
    app.kubernetes.io/version: 1.27.3
    helm.sh/chart: nginx-18.2.6
  name: test-nginx
  namespace: default
---
apiVersion: v1
kind: Secret
metadata:
  labels:
    app.kubernetes.io/instance: test-nginx
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: nginx
    app.kubernetes.io/version: 1.27.3
    helm.sh/chart: nginx-18.2.6
  name: test-nginx-tls
  namespace: default
type: kubernetes.io/tls
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/instance: test-nginx
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: nginx
    app.kubernetes.io/version: 1.27.3
    helm.sh/chart: nginx-18.2.6
  name: test-nginx
  namespace: default
spec:
  # ... (service configuration)
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/instance: test-nginx
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: nginx
    app.kubernetes.io/version: 1.27.3
    helm.sh/chart: nginx-18.2.6
  name: test-nginx
  namespace: default
spec:
  # ... (deployment configuration)
---
# ... (additional resources: PodDisruptionBudget, NetworkPolicy, etc.)

Actual output

Error: Error: unknown shorthand flag: 'c' in -c
: unable to run: 'helm version -c --short' with env=[HELM_CONFIG_HOME=/tmp/kustomize-helm-1488621679/helm HELM_CACHE_HOME=/tmp/kustomize-helm-1488621679/helm/.cache HELM_DATA_HOME=/tmp/kustomize-helm-1488621679/helm/.data] (is 'helm' installed?): exit status 1

Kustomize version

v5.8.0

Operating system

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions