Commit Graph

192 Commits

Author SHA1 Message Date
Matt Farina 61d3eca55c
Move pkg/chart to pkg/chart/v2 to prepare for v3 charts
This change moves the code, updates the import locations, and
adds a doc.go file to document what the v2 package is for.

This is part of HIP 20 for v3 charts

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-02-25 15:20:44 -05:00
Matt Farina 18ca7c1002
Move pkg/releaseutil to pkg/release/util
The releaseutil package was originally designed to work against a
generated codebase from a protobuf in Helm v2. This is when Helm
used gRPC to communicate to a server side component named Tiller.
When Helm moved everything client side, this package remained and
it supported the release package.

This change moves releaseutil to be a sub-packge of release. This
is part of the change to support apiVersion v3 charts which is
documented in HIP 20

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-02-24 14:58:51 -05:00
Matt Farina 5c0deec327
Moving chartutil to chart/util
chartutil was originally created to operate on protobufs which are
no longer part of Helm. The util package makes more sense to be
part of the chart package.

This change is part of the HIP 20 to create v3 charts and
explicitly call out v2 charts. The changes for this are in smaller
bite size changes.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-02-21 15:25:55 -05:00
George Jenkins 0ce267d907 more options
Signed-off-by: George Jenkins <gvjenkins@gmail.com>
2025-01-24 20:44:45 -08:00
George Jenkins 7ea1d1df66 refactor: Remove duplicate `FindChartIn*RepoURL` funcs
Signed-off-by: George Jenkins <gvjenkins@gmail.com>
2025-01-24 20:26:39 -08:00
George Jenkins 415c7e10fd
Merge pull request #13516 from TerryHowe/new-lint
chore: fix problems with latest lint
2025-01-23 18:30:23 -08:00
Payal Godhani f8a08145fb Resolving conflict
-e
Signed-off-by: Payal Godhani <godhanipayal@gmail.com>
2025-01-08 15:36:06 -08:00
Matt Farina f08e2d14bb Updating to helm.sh/helm/v4
Since Helm is going through breaking changes with Helm v4, the version path to
Helm needs to be updated.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2025-01-08 15:34:20 -08:00
Payal Godhani 5b18f525ed Fixing a typo
-e
Signed-off-by: Payal Godhani <godhanipayal@gmail.com>
2024-12-16 21:27:20 -08:00
Payal Godhani 34cd8341c3 Add Contextual Error Messages to RunWithContext
-e
Signed-off-by: Payal Godhani <godhanipayal@gmail.com>
2024-12-16 21:07:56 -08:00
Terry Howe 569f62e58b chore: fix problems with latest lint
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
2024-12-10 10:40:37 -07:00
Scott Rigby bca7d31c9b
Merge pull request #12769 from banjoh/em/password-to-oci-registries
fix(helm): pass down username/password CLI parameters to OCI registry clients
2024-11-19 16:29:11 -05:00
mathieu cesbron fc17fc75e2 Fix typo "re-use" to "reuse"
Signed-off-by: mathieu cesbron <mathieu.rudy.cesbron@gmail.com>
2024-11-07 18:40:13 +07:00
Evans Mungai 323f88950a
Merge remote-tracking branch 'origin/main' into em/password-to-oci-registries 2024-10-22 17:54:10 +01:00
Nathan Baulch ef85fa7f2d
Grammar fixes
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2024-09-14 10:30:31 +10:00
Nathan Baulch ff9dd262e3
Fix typos
Signed-off-by: Nathan Baulch <nathan.baulch@gmail.com>
2024-09-14 10:29:56 +10:00
Matt Farina c261d0655c
Merge pull request #12876 from manno/sdk-ignore-missing-annotations
Allow install, update action to adopt existing resources (sdk only)
2024-08-14 15:56:37 -04: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
anessi acf7158565
feat(helm): add --skip-schema-validation flag to helm 'install', 'upgrade' and 'lint'
When --skip-schema-validation is set, any schema contain in the helm chart is ignored. Defaults to 'false'.

Closes #10398

Signed-off-by: anessi <16045045+anessi@users.noreply.github.com>
2024-06-25 16:43:48 +02: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
Andrew Block 414cf94666
Merge pull request #11600 from miles-w-3/chart-notes
Added support for hiding notes from install/upgrade output
2024-06-12 06:24:59 -05:00
Evans Mungai 76c0f297c1
Merge remote-tracking branch 'origin/main' into em/password-to-oci-registries 2024-05-01 18:27:45 +01:00
Mario Manno a7856c0398 Add ability to adopt unmanaged resources
Allow the SDK actions to adopt existing resources. This allows install
and update to overwrite resources. If TakeOwnership is not set, adoption
is only possible if they existing resources have the right labels
(managed-by) and annotations (release-name, ...).

Signed-off-by: Mario Manno <mmanno@suse.com>
2024-03-13 14:09:23 +01:00
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
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
Miles Wilson 0c541398f2 Added support for hiding notes from install/upgrade output
Signed-off-by: Miles Wilson <wilson.mil@icloud.com>
2023-10-05 15:59:58 -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