Commit graph

167 commits

Author SHA1 Message Date
Matt Farina
25c473834e Enabling hide secrets on install and upgrade dry run
This change adds a new flag to the install and upgrade commands in
the Helm client and properties to the install and upgrade action.
The new flag is --hide-secret and can only be used with the
--dry-run flag.

The --dry-run flag is designed to send all chart rendered manifests to
stdout so that they can be inspected.

When the --hide-secret flag is used the Secret content is removed from
the output.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2024-03-13 08:34:28 -04:00
Michał Słapek
169561a1b3 Fix leaking goroutines in Install
Signed-off-by: Michał Słapek <28485371+mslapek@users.noreply.github.com>
2023-09-18 20:13:47 +01:00
Joe Julian
4ff7d90872
Merge remote-tracking branch 'upstream/main' into add-labels-to-install-upgrade 2023-08-23 10:42:16 -07: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
Dmitry Chepurovskiy
735ff8f92c
Update pkg/action/install.go
Signed-off-by: Dmitry Chepurovskiy <me@dm3ch.net>
2023-07-30 17:57:01 +03:00
Matt Farina
343389856b
Merge pull request #12162 from mattfarina/fix-merge-values-ugh
Fix multiple bugs in values handling
2023-07-26 09:30:09 -04:00
Dmitry Chepurovskiy
7b13ac9914
Added error in case try to supply custom label with name of system label during install/upgrade
Signed-off-by: Dmitry Chepurovskiy <me@dm3ch.net>
2023-07-25 17:55:05 +03: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
Matt Farina
838b12191e
Merge pull request #9426 from tapaskapadia/feat/lookup-dryrun
feat(helm): add ability for --dry-run to do lookup functions
2023-07-20 13:30:52 -04:00
Joe Julian
8554d518d5
Merge pull request #10397 from mtesseract/mc/fix-err-message-on-existing-resource-conflict
Adjust error message wrongly claiming that there is a resource conflict
2023-07-13 08:20:16 -07:00
Matt Farina
0a5148faff
Fix multiple bugs in values handling
First, some notes about priority and how some code flow works.

For Helm handling values, the expected order of precidence is:
1. User specified values (e.g CLI)
2. Imported values
3. Parent chart values
4. Subchart values

Helm handles dependency values slightly differently. If there are dependencies
in the charts folder that are not marked as dependencies all of the values,
including nil values, are pulled in. If those charts are listed as a
dependency in the Chart.yaml file than they are processed for import handling.
Prior to the changes here, it caused nil values at the top level to NOT remove
values specified.

The changes:

1. The order of priority was chagned from the list above. Parnet chart values
would override specifically imported values. This is due to a change from
just over a year ago that introduced a bug. That was undone by changing the
precidence when maps were merged.

2. To handle merging while retaining the nil values, which was causing
inconsistent behavior, a new set of Merge functions were introduced. These
functions are just like coalesce except that they DO NOT remove nil/null values.
The new functions are used in a backward compatible manner meaning some new
functions were introduced that called them.

Specific issues fixed (that are known):

Closes #9027

Can now delete subkeys from charts when specified in the parent. This behavior
was previously inconsistent. Sometimes they could be deleted and other times
it did not work. Now it is consistent.

Closes #10899

Imported values (from library or other subcharts) are now used following the
order above.

The previous behavior was inconsistent. import-values using just a string
would import them. When named with a child/parent it did not work if the
parent already had a value. If string and named were mixed the imports
worked if the string happened first but just for the string not the named.
If the named parent/child went first then none of them worked for cases
where the parent already had a value. It was inconsistent and the tests
sometimes mirrored the functionality rather than expected behavior.

Tests for this fall into the sub-packages and are in the template tests
to verify it's happening in the output. Including having values passed
at the CLI as the ultimate highest priority to be used.

This relates to a fix that went in for #9940. The expected values there don't
fit the precedence above where the parent value would override the imported
value. That fix/change introduced more bugs.

Closes #10052

This is the case where imported values using the parent/child designation
just didn't work right. That has been fixed and there are tests. The underlying
issue had to do with the precedence order handling.

Note, a lot of tests were added. Hope we got it more right this time.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-06-26 11:37:21 -04:00
wujunwei
c87f846d88 add GetRegistryClient method
Signed-off-by: wujunwei <wjw3323@live.com>
2023-06-15 11:49:23 +08: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
Matt Farina
7c9d636f40
Fix goroutine leak in action install
During the install process there was a place where an install
process could be stuck trying to write to a channel. This would
happen when a context had completed prior to performInstall
finishing. In a short running Helm Client this was not a problem.
But, for long running applications that use Helm as an SDK there
are problems where a memory leak ends up happening due to
goroutines never being able to complete.

This fix provides a means for performInstall to write to its
channel using the method already used to fix the upgrade
issue of the same kind.

Fixes #11805

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-04-10 16:45:41 -04: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
Matt Farina
4e7e939f19
Updating the Go version in go.mod
At this time both Go 1.19 and 1.20 are supported. The version
specified in the go.mod file is the minimum version we expect Helm
to be compiled against. This is the oldest supported version to
support environments where others compile Helm. The Helm project
is using Go 1.20 to build Helm itself.

Updating to Go 1.19 also includes dealing with io/ioutil
deprecation and some additional linting issues around staticcheck.
All the staticcheck issues were in test files so linting was
skipped for those.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-03-22 11:52:30 -04:00
Matt Farina
299a6463a0
Merge pull request #11886 from hiddeco/properly-invalidate-client
Properly invalidate client after CRD install
2023-03-22 10:36:41 -04: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
Hidde Beydals
68f7b1f194
Properly invalidate client after CRD install
As the CRDs are installed before the capabilities are gathered, the
current call to invalidate the discovery client is premature and
expensive.

What actually is required is an invalidation of the REST mapper, as
otherwise the Helm install action may later on fail with a `resource
mapping not found` error. More specifically when the caller of the
action is making use of a persisting[1] `RESTClientGetter`.

Which is not something done by the Helm CLI (albeit it could, and this
would potentially save quite some resources?). But is a default
configuration offered by the Helm SDK via `kube.New` when a nil value
is provided as the `getter`.

[1]: https://github.com/kubernetes/cli-runtime/blob/v0.26.2/pkg/genericclioptions/config_flags.go#L118

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 20:07:41 +01: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
Andrew Block
08593c8dd6
Added support for insecure OCI registries
Signed-off-by: Andrew Block <andy.block@gmail.com>
2023-03-03 07:33:17 -06:00
Soule BA
b0ecb21056
Enable custom certificates option for OCI
If implemented, users will be able to use custom certificates and CA to
while interacting with OCI registries.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2023-03-03 07:33:17 -06:00
Dmitry Chepurovskiy
6853c3eab5
Merge remote-tracking branch 'origin/main' into add-labels-to-install-upgrade 2023-02-17 02:02:25 +02:00
Matt Farina
863bc74e5a
Update to func handling
Signed-off-by: Matt Farina <matt@mattfarina.com>
2023-02-03 15:36:32 -05:00
Tapas Kapadia
f9e54b6079 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 #8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-01-30 17:04:10 -06:00
Tapas Kapadia
25ac62e153 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 #8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-01-27 20:08:44 -06:00
Tapas Kapadia
9a0025f963 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 #8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-01-23 14:28:29 -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
be99ebe8af 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 #8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-01-16 16:10:25 -06:00
Tapas Kapadia
4d67dfabaa 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 #8137

Signed-off-by: Tapas Kapadia <tapaskapadia10@gmail.com>
2023-01-16 12:43:15 -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
Tapas Kapadia
92a6640f8a 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-01-16 12:43:15 -06:00
Vaibhav Sharma
3181c7ddad fix adopted resource not replaced
Signed-off-by: Vaibhav Sharma <17532va@gmail.com>
2022-12-24 00:19:06 +05:30
Martin Hickey
f08db5c899
Merge pull request #10834 from stan-sz/stan-sz/10285
Log error message on failed download
2022-08-12 09:57:16 +01:00
Dmitry Chepurovskiy
6ef79e432b
Add labels support for install action with secret storage backend
Signed-off-by: Dmitry Chepurovskiy <dm3ch@dm3ch.net>
Signed-off-by: Dmitry Chepurovskiy <me@dm3ch.net>
2022-06-17 21:36:31 +03:00
stan-sz
6c55d9e3e9 Fix linter
Signed-off-by: GitHub <noreply@github.com>
2022-04-11 09:14:26 +00:00
stan-sz
a7e4ae752a Update install.go
Feedback from PR

Signed-off-by: GitHub <noreply@github.com>
2022-04-11 09:00:48 +00:00
stan-sz
660e4ffe7a Log error message on failed download
Signed-off-by: GitHub <noreply@github.com>
2022-04-11 09:00:48 +00:00
yxxhero
9f199b6517 fix --registry-config issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-03-12 16:56:23 +08:00
Matt Farina
1ec0aacb88
Merge pull request #10486 from gridai/fix-install-leak
Fix install memory/goroutine leak
2022-01-27 15:03:58 -05:00
Thomas Runyon
353d74e967 refactor internal/experimental/registry to pkg/registry
Signed-off-by: Thomas Runyon <runyontr@gmail.com>
2022-01-12 21:49:26 -05:00
Matt Farina
548ec55cf9
Fix panic with OCI for install, upgrade, and show
When range support for OCI went in via #10527 it created a situation
where some lookups for a chart could cause a panic. This change
makes sure the registry client is available to lookup OCI charts

Signed-off-by: Matt Farina <matt.farina@suse.com>
2022-01-12 21:30:27 -05:00
Andrew Block
df98e18eb7
Working oci code without providing versions
Signed-off-by: Andrew Block <andy.block@gmail.com>
2022-01-11 21:47:03 -05: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
Neven Miculinic
5059ae843e Fix install memory/goroutine leak
Signed-off-by: Neven Miculinic <neven.miculinic@gmail.com>
2021-12-20 10:17:38 +01:00
Moritz Clasmeier
8613770f78 Adjust error message wrongly claiming that there is a resource conflict
Signed-off-by: Moritz Clasmeier <moritz@stackrox.com>
2021-11-24 11:20:39 +01:00
cndoit18
da15d96a68
fix(install): if subcharts are disabled, the CRD for subcharts should not be installed
Signed-off-by: cndoit18 <cndoit18@outlook.com>
2021-09-01 13:57:46 +08:00
Matt Farina
accf82ba1c
Merge pull request #9180 from Moser-ss/feature-handle-SIGINT
Handle SIGTERMs during helm upgrade and helm install
2021-08-30 18:18:13 -04:00
Stephane Moser
c62ce12bed Refactor SIGTERM logic
Use context to handle SIGTERM in the cmd/helm instead of pkg/action

Signed-off-by: Stephane Moser <moser.sts@gmail.com>
2021-07-26 01:04:58 +01:00
Stephane Moser
c6c4157c43 Move locks from global var to the structs
Signed-off-by: Stephane Moser <moser.sts@gmail.com>
2021-07-04 12:10:11 +01:00