95 Commits

Author SHA1 Message Date
George Jenkins
0ae8e4f2cb [dev-v3] Bump Go v1.25, golangci-lint v2
Signed-off-by: George Jenkins <gvjenkins@gmail.com>
2025-12-21 12:35:53 -08:00
Evans Mungai
0687961da4 Revert CAFile rename breaking change
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
2024-08-02 16:57:09 +01:00
Evans Mungai
837ae4242c Add username/password to dependency build/update subcommands
Signed-off-by: Evans Mungai <mbuevans@gmail.com>
2024-06-19 16:37:44 +01:00
Evans Mungai
76c0f297c1 Merge remote-tracking branch 'origin/main' into em/password-to-oci-registries 2024-05-01 18:27:45 +01:00
Robert Sirchia
d58d7b3762 Fixing all the linting errors
Cleaned up all the linting errors we are getting.

Signed-off-by: Robert Sirchia <rsirchia@outlook.com>
2024-03-11 17:13:34 -04:00
Evans Mungai
dc158f6208 fix(helm): pass down username/password CLI parameters to OCI registry clients
When username/password parameters are passed in via the CLI
they are not passed down to the client handling requests to
OCI registries. This change ensures this happens

Signed-off-by: Evans Mungai <mbuevans@gmail.com>
2024-02-05 14:02:15 +00:00
Scott Rigby
7d190be0d0 Merge pull request #12128 from aryan9600/plain-http
oci: Add flag --plain-http to enable working with HTTP registries
2023-08-01 14:32:06 -04:00
Matt Farina
96e33e2773 Tweaking new dry-run internal handling
There are a few changes to the new dry-run handling:

1. Some documentation is added to help clarify what is happening
   and what is expected.
2. DryRun is never changed by internal handling. If an API user
   sets the property it is not changed by our code.
3. The behavior on contacting the server with false/none is made
   consistent between install and upgrade.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-07-20 14:26:46 -04:00
Sanskar Jaiswal
2538b927a7 oci: Add flag --plain-http to enable working with HTTP registries
Add a new flag `--plain-http` to the following commands:
* `helm install`
* `helm pull`
* `helm push`
* `helm template`
* `helm upgrade`
* `helm show`

This flag instructs the registry client to use plain HTTP connections,
thus enabling upload/download of charts from OCI registries served at
an HTTP endpoint.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-06-09 14:43:53 +05:30
Tapas Kapadia
b7a2d47eca feat(helm): add ability for --dry-run to do lookup functions
When a helm command is run with the --dry-run flag, it will try to connect to the cluster
to be able to render lookup functions.
Closes #8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-05-01 00:04:04 -05:00
Tapas Kapadia
4b7248e361 feat(helm): add ability for --dry-run to do lookup functions
When a helm command is run with the --dry-run flag, it will try to connect to the cluster
if the value is 'server' to be able to render lookup functions.
Closes helm#8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-04-08 18:43:01 -05:00
Tapas Kapadia
4899e8a788 feat(helm): add ability for --dry-run to do lookup functions
When a helm command is run with the --dry-run flag, it will try to connect to the cluster
if the value is 'server' to be able to render lookup functions.
Closes helm#8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-03-10 02:45:30 -06:00
Soule BA
11738dde51 Provide a helper to set the registryClient in cmd
If enabled the registryClient is set using a helper that accepts the TLS
flags. This keeps the client creation consistent accross the different
commands.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2023-03-03 07:33:17 -06:00
Tapas Kapadia
ddb33580db feat(helm): add ability for a dry-run to evaluate lookup functions
When a helm command is run with the --dry-run-option=server flag, it will try to connect to the cluster
to be able to render lookup functions.
Closes #8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-01-23 13:18:59 -06:00
Tapas Kapadia
51281c195a feat(helm): add ability for --dry-run to do lookup functions
When a helm command is run with the --dry-run flag, it will try to connect to the cluster
if the value is 'server' to be able to render lookup functions.
Closes helm#8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-01-16 12:43:15 -06:00
yxxhero
1c25a1fadd fix template --output-dir issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-10 07:35:35 +08:00
Ryan Drew
5aa316e1ee Add support for CSVs in template --api-versions arg
This commit changes the template sub-command argument
`--api-versions` from `StringArrayVarP` to `StringSliceVarP`,
to allow support for comma separated variables. This will allow
users to use a syntax such as `--api-versions one,two,three` over
`--api-versions one --api-versions two --api-versions three`.

Fixes: #11485

Signed-off-by: Ryan Drew <ryan.drew@isovalent.com>
2022-10-31 10:42:31 -06:00
mengjiao.liu
160da867d0 validate release name during install
Signed-off-by: mengjiao.liu <mengjiao.liu@daocloud.io>
2021-12-29 14:45:05 +08:00
Thomas Dy
47c8f48f20 feat(helm): Support setting --kube-version
Signed-off-by: Thomas Dy <thatsmydoing@gmail.com>
2021-04-07 17:27:53 +09:00
Josh Soref
2bf8fdf45d chore: Spelling (#9410)
* spelling: annotate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: asserts

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: behavior

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: binary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: contain

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: copied

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: depending

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deprecated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: doesn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: donot

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: github

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inputting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iteration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: jabberwocky

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kubernetes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: length

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mismatch

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: nonexistent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: outputs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: panicking

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: plugins

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parsing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: porthos

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: regular

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: resource

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repositories

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: something

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: strict

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: string

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-15 21:11:57 -04:00
Torsten Walter
9ea10ef04a Skip tests when running helm template
Signed-off-by: Torsten Walter <mail@torstenwalter.de>
2020-10-14 16:25:42 +02:00
Torsten Walter
3d66daeb55 fix(helm): allow skipping manifests in tests directories
When helm template is called with `--skip-tests` no manifests
in tests directories are rendered. No matter if they have a
`"helm.sh/hook": test` annotation or not.

This helps to avoid rendering manifests which are only used for test
execution.

Closes #8691

Signed-off-by: Torsten Walter <mail@torstenwalter.de>
2020-09-08 11:26:20 +02:00
Matt Farina
44212f83dc Fix issue with install and upgrade running all hooks
When #8156 was merged it had the side effect that all hooks were
run all the time. All the hooks were put in the flow of the
content rendered and sent to Kubernetes on every command.

For example, if you ran the following 2 commands the test hooks
would run:

    helm create foo
    helm install foo ./foo

This should not run any hooks. But, the generated test hook is run.

The change in this commit moves the writing of the hooks to output
or disk back into the template command rather than in a private
function within the actions. This is where it was for v3.2.

One side effect is that post renderers will not work on hooks. This
was the case in v3.2. Since this bug is blocking the release of v3.3.0
it is being rolled back. A refactor effort is underway for this section
of code. post renderer for hooks should be added back as part of that
work. Since post renderer hooks did not make it into a release it
is ok to roll it back for now.

There is code in the cmd/helm package that has been duplicated from
pkg/action. This is a temporary measure to fix the immediate bug
with plans to correct the situation as part of a refactor
of renderResources.

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-07-28 09:52:39 -04:00
DongGang
ceff32d5f8 fix(template):Issue:helm template with --output-dir (#8156)
* fix(template):Issue:helm template with --output-dir doesn't write template with a hook to file

Close #7836

Signed-off-by: Dong Gang <dong.gang@daocloud.io>

* fix go file style

Signed-off-by: Dong Gang <dong.gang@daocloud.io>

* fix go file style

Signed-off-by: Dong Gang <dong.gang@daocloud.io>
2020-07-07 08:44:22 -07:00
ShenXinkang
4f136861d3 fix template command use --show-only flags error in windows environment
Signed-off-by: ShenXinkang <610716076@qq.com>
2020-06-26 11:42:58 +08:00
Marc Khouzam
561cc42808 feat(comp): Provide completion for --version flag
This commit allows to use shell completion to obtain the list of
available versions of a chart referenced in a 'repo/chart' format.
It applies to:
- helm install
- helm template
- helm upgrade
- helm show
- helm pull

The 'repo/chart' argument must be present for completion to be triggered
(or else we don't yet know which chart to fetch the versions for).

The completion can be slow for the 'stable' repo because its index
file takes some time to parse.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-06-18 14:00:40 -04:00
Marc Khouzam
88a3d6eaea feat(comp): Move custom completions to Cobra 1.0
Cobra 1.0 introduces custom Go completions.  This commit replaces Helm's
own solution to use Cobra's solution.

This allows to completely remove Helm's internal "completion" package.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-06-11 16:52:39 -04:00
Mario Valderrama
6414791e08 Improve --show-only flag (#7816)
* Improve --show-only flag
* Ensure consistent manifest ordering
2020-04-02 14:09:45 -07:00
Matthew Fisher
2c10f96b59 Merge pull request #7556 from unguiculus/template-output
Fix 'helm template' to also print invalid yaml
2020-03-02 12:04:00 -08:00
Pavel Macík
f05ffdd2da Fix golangci-lint errors.
Signed-off-by: Pavel Macík <pavel.macik@gmail.com>
2020-02-26 14:08:12 +01:00
Reinhard Naegele
a35e124b66 Place rendering invalid YAML under --debug flag
Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>
2020-02-12 20:36:04 +01:00
Reinhard Naegele
2a73967ca2 Fix 'helm template' to also print invalid yaml
Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>
2020-02-07 20:14:33 +01:00
Taylor Thomas
7a3049a418 chore(postrender): Adds unit tests for exec post renderer
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2020-02-07 10:29:59 -07:00
Mike Tougeron
e78402d559 fix conflicts
Signed-off-by: Mike Tougeron <tougeron@adobe.com>
2020-02-04 13:16:51 -08:00
Martin Hickey
084ab20f67 feat(template): Allow template output to use release name (#7503)
* Allow template output to use release name

helm template output command uses the chart name only when writing
templates to disk. This changes will also use the release name
to avoid colloiding the path when output nore than one release
of smae chart.

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>

* Update after review

Comment:
- https://github.com/helm/helm/pull/7503/files#r374130090

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2020-02-04 17:27:38 +01:00
Lee Bontecou
e483dce289 fix(template): helm template "--show-only" flag producing duplicates when flag used more than once (#7204)
* bugfix template show-only duplicates

Signed-off-by: Lee Bontecou <lbontecou@thezebra.com>

* 7203 - add unittests

Signed-off-by: Lee Bontecou <lbontecou@thezebra.com>

* attempt formatting fix

Signed-off-by: Lee Bontecou <lbontecou@thezebra.com>

* gofmt-ed with -s

Signed-off-by: Lee Bontecou <lbontecou@thezebra.com>

* goimports-ed with -local helm.sh/helm/v3 and gofmt-ed with -s -w

Signed-off-by: Lee Bontecou <lbontecou@thezebra.com>

* Update template_test.go

Signed-off-by: Lee Bontecou <lbontecou@thezebra.com>

* Update template_test.go

Signed-off-by: Lee Bontecou <lbontecou@thezebra.com>
2020-01-30 11:24:09 +00:00
Mike Tougeron
804e07300b Render the CRDs to spec files
Signed-off-by: Mike Tougeron <tougeron@adobe.com>
2020-01-20 13:31:26 -08:00
Marc Khouzam
de1ca6784a feat(comp): Support --generate-name in completion
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-01-15 19:02:58 -05:00
Marc Khouzam
9240e78124 feat(comp): Dynamic completion of arguments in Go
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-01-15 19:02:58 -05:00
Fabian Ruff
cb81b07125 Reintroduce --is-upgrade to template command
This change allows correct rendering of manifests for the upgrade case using `helm template`.

Signed-off-by: Fabian Ruff <fabian.ruff@sap.com>
2019-12-07 00:38:14 +01:00
Graham Goudeau
01aa1bd3a2 Add a flag to allow template to output CRDs
Signed-off-by: Graham Goudeau <graham.goudeau@solo.io>
2019-12-03 14:06:55 -05:00
Taylor Thomas
432fd9c110 fix(cmd): Updates description for template validation flag
This is a follow up to discussion in #6663 that clarifies exactly what the
validate flag is doing. It isn't meant to be a generic schema validator, but
rather validates the manifests against the current cluster as if it was
going to be installing them.

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-10-31 09:26:22 -06:00
Yusuke Kuoka
74a2adf6c5 fixup! fix(v3): Bring back the missing helm template [-x|--execute] PATH/TO/SINGLE/TEMPLATE
Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2019-10-11 15:06:42 +09:00
Yusuke Kuoka
267528848c fix(v3): Bring back the missing helm template [-x|--execute] PATH/TO/SINGLE/TEMPLATE
Closes https://github.com/helm/helm/issues/6633

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2019-10-10 22:33:19 +09:00
Taylor Thomas
59d3488d1c feat(template): Ports api-versions flag to v3
This is a port of #5392. It also takes care of the small chore to update the default k8s
version to 1.16, which is the latest supported version

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-10-07 13:30:06 -06:00
Matt Farina
9bc7934f35 Updating the module for v3 as the major version
Signed-off-by: Matt Farina <matt@mattfarina.com>
2019-10-03 14:27:05 -04:00
Yusuke Kuoka
5c18e1b89f fix(helm3): helm template output should include hooks by default
This fixes `helm template [--no-hooks]` to work like proposed in #6443

Manually tested with running `helm template` against `stable/mysql` chart with helm 2, helm 3.0.0-beta.3, and helm 3 after this fix.

The manual test report follows. Assume `helmv3` is 3.0.0-beta.3 and `helmv3-nohooksfix` is the binary build from this PR.

```
$ helmv3 fetch stable/mysql

$ helmv3 template mysql-1.3.1.tgz > helm-template-mysql-helm-3.yaml

$ helmv3-nohooksfix template mysql-1.3.1.tgz > helm-template-mysql-helm-3-with-fix.yaml

$ helmv3-nohooksfix template --no-hooks mysql-1.3.1.tgz > helm-template-mysql-helm-3-with-fix-nohooks-enabled.yaml
```

The example below shows that this fix changes `helm template` to output hooks by default:

```
$ diff --unified helm-template-mysql-helm-3{,-with-fix}.yaml
--- helm-template-mysql-helm-3.yaml	2019-09-17 22:21:38.000000000 +0900
+++ helm-template-mysql-helm-3-with-fix.yaml	2019-09-17 22:21:53.000000000 +0900
@@ -13,10 +13,10 @@
 type: Opaque
 data:

-  mysql-root-password: "VGtybWh5N3JnWA=="
+  mysql-root-password: "aGpHN2VEbnhvVA=="

-  mysql-password: "OTNQSXdNVURBYw=="
+  mysql-password: "UmpwQkVuMHpoQQ=="
 ---
 # Source: mysql/templates/tests/test-configmap.yaml
 apiVersion: v1
@@ -167,3 +167,48 @@
           claimName: RELEASE-NAME-mysql
       # - name: extras
       #   emptyDir: {}
+---
+# Source: mysql/templates/tests/test.yaml
+apiVersion: v1
+kind: Pod
+metadata:
+  name: RELEASE-NAME-mysql-test
+  namespace: default
+  labels:
+    app: RELEASE-NAME-mysql
+    chart: "mysql-1.3.1"
+    heritage: "Helm"
+    release: "RELEASE-NAME"
+  annotations:
+    "helm.sh/hook": test-success
+spec:
+  initContainers:
+    - name: test-framework
+      image: "dduportal/bats:0.4.0"
+      command:
+      - "bash"
+      - "-c"
+      - |
+        set -ex
+        # copy bats to tools dir
+        cp -R /usr/local/libexec/ /tools/bats/
+      volumeMounts:
+      - mountPath: /tools
+        name: tools
+  containers:
+    - name: RELEASE-NAME-test
+      image: "mysql:5.7.14"
+      command: ["/tools/bats/bats", "-t", "/tests/run.sh"]
+      volumeMounts:
+      - mountPath: /tests
+        name: tests
+        readOnly: true
+      - mountPath: /tools
+        name: tools
+  volumes:
+  - name: tests
+    configMap:
+      name: RELEASE-NAME-mysql-test
+  - name: tools
+    emptyDir: {}
+  restartPolicy: Never
```

The example below shows that `helm template --no-hooks` can be used for excluding hooks:

```
$ diff --unified helm-template-mysql-helm-3{,-with-fix-nohooks-enabled}.yaml
--- helm-template-mysql-helm-3.yaml	2019-09-17 22:21:38.000000000 +0900
+++ helm-template-mysql-helm-3-with-fix-nohooks-enabled.yaml	2019-09-17 22:22:03.000000000 +0900
@@ -13,10 +13,10 @@
 type: Opaque
 data:

-  mysql-root-password: "VGtybWh5N3JnWA=="
+  mysql-root-password: "Zk1LYUd6OWgzaQ=="

-  mysql-password: "OTNQSXdNVURBYw=="
+  mysql-password: "OTZPZU9hdlFORg=="
 ---
 # Source: mysql/templates/tests/test-configmap.yaml
 apiVersion: v1
```

Fixes #6443

Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
2019-09-28 09:18:45 +09:00
Taylor Thomas
c9c95ea148 ref(*): Moves packages to internal
These packages are generally used only for logic inside of Helm and
can later be re-exported as needed

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-08-09 16:02:33 -06:00
Joe Lanford
8a4b70b1e3 review: move ValueOptions to SDK
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
2019-08-01 20:00:47 -04:00
Joe Lanford
68ee30b48c cmd/*,pkg/*: move ValueOptions to cmd package and decouple from SDK
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
2019-08-01 11:04:36 -04:00