From 3492b0ddb34a7b9045563cd795fbef1b59046602 Mon Sep 17 00:00:00 2001 From: Levi Blackstone Date: Sun, 17 Nov 2019 17:34:37 -0700 Subject: [PATCH] Update args to support either helm 2 or 3 (#882) The --name arg is no longer present in helm v3 for helm template, but --name-template appears to accomplish the same thing in both versions. Updated the helm fetch command to use that parameter instead, which should work for both. --- .travis.yml | 7 ++++--- CHANGELOG.md | 4 ++++ pkg/gen/nodejs-templates/helm/v2/helm.ts | 2 +- pkg/gen/python-templates/helm/v2/helm.py | 2 +- sdk/nodejs/helm/v2/helm.ts | 2 +- sdk/python/pulumi_kubernetes/helm/v2/helm.py | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 448f4c933a..849a8ca308 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,10 +43,11 @@ install: - source ${PULUMI_SCRIPTS}/ci/install-common-toolchain.sh # Install Helm CLI. Do not install Tiller. - - curl -LO https://storage.googleapis.com/kubernetes-helm/helm-v2.14.3-linux-amd64.tar.gz - - tar -xvf helm-v2.14.3-linux-amd64.tar.gz + - curl -LO https://get.helm.sh/helm-v3.0.0-linux-amd64.tar.gz + - tar -xvf helm-v3.0.0-linux-amd64.tar.gz - sudo mv linux-amd64/helm /usr/local/bin - - helm init --client-only + - helm repo add stable https://kubernetes-charts.storage.googleapis.com/ + - helm repo update # Install Pulumi - curl -L https://get.pulumi.com/ | bash diff --git a/CHANGELOG.md b/CHANGELOG.md index 79b3329f23..353de8fa2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - v1.15.x - v1.14.x +### Improvements + +- Add support for helm 3 CLI tool. (https://github.com/pulumi/pulumi-kubernetes/pull/882). + ## 1.3.0 (November 13, 2019) ### Supported Kubernetes versions diff --git a/pkg/gen/nodejs-templates/helm/v2/helm.ts b/pkg/gen/nodejs-templates/helm/v2/helm.ts index 0c3e33401e..76ba3a6b5a 100644 --- a/pkg/gen/nodejs-templates/helm/v2/helm.ts +++ b/pkg/gen/nodejs-templates/helm/v2/helm.ts @@ -193,7 +193,7 @@ export class Chart extends yaml.CollectionComponentResource { ? `--namespace ${shell.quote([cfg.namespace])}` : ""; const yamlStream = execSync( - `helm template ${chart} --name ${release} --values ${defaultValues} --values ${values} ${namespaceArg}`, + `helm template ${chart} --name-template ${release} --values ${defaultValues} --values ${values} ${namespaceArg}`, { maxBuffer: 512 * 1024 * 1024 // 512 MB }, diff --git a/pkg/gen/python-templates/helm/v2/helm.py b/pkg/gen/python-templates/helm/v2/helm.py index 7b274073a4..a97109f213 100644 --- a/pkg/gen/python-templates/helm/v2/helm.py +++ b/pkg/gen/python-templates/helm/v2/helm.py @@ -339,7 +339,7 @@ def _parse_chart(all_config: Tuple[str, Union[ChartOpts, LocalChartOpts], pulumi namespace_arg = ['--namespace', config.namespace] if config.namespace else [] # Use 'helm template' to create a combined YAML manifest. - cmd = ['helm', 'template', chart, '--name', release_name, + cmd = ['helm', 'template', chart, '--name-template', release_name, '--values', default_values, '--values', overrides_filename] cmd.extend(namespace_arg) diff --git a/sdk/nodejs/helm/v2/helm.ts b/sdk/nodejs/helm/v2/helm.ts index 0c3e33401e..76ba3a6b5a 100644 --- a/sdk/nodejs/helm/v2/helm.ts +++ b/sdk/nodejs/helm/v2/helm.ts @@ -193,7 +193,7 @@ export class Chart extends yaml.CollectionComponentResource { ? `--namespace ${shell.quote([cfg.namespace])}` : ""; const yamlStream = execSync( - `helm template ${chart} --name ${release} --values ${defaultValues} --values ${values} ${namespaceArg}`, + `helm template ${chart} --name-template ${release} --values ${defaultValues} --values ${values} ${namespaceArg}`, { maxBuffer: 512 * 1024 * 1024 // 512 MB }, diff --git a/sdk/python/pulumi_kubernetes/helm/v2/helm.py b/sdk/python/pulumi_kubernetes/helm/v2/helm.py index 7b274073a4..a97109f213 100644 --- a/sdk/python/pulumi_kubernetes/helm/v2/helm.py +++ b/sdk/python/pulumi_kubernetes/helm/v2/helm.py @@ -339,7 +339,7 @@ def _parse_chart(all_config: Tuple[str, Union[ChartOpts, LocalChartOpts], pulumi namespace_arg = ['--namespace', config.namespace] if config.namespace else [] # Use 'helm template' to create a combined YAML manifest. - cmd = ['helm', 'template', chart, '--name', release_name, + cmd = ['helm', 'template', chart, '--name-template', release_name, '--values', default_values, '--values', overrides_filename] cmd.extend(namespace_arg)