Commit graph

1838 commits

Author SHA1 Message Date
Eng Zer Jun
2ceebffc77
test: replace ensure.TempDir with t.TempDir
This commit replaces `ensure.TempDir` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `ensure.TempDir`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-07-29 16:11:22 +08: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
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
14d363669f
Merge pull request #11529 from wujunwei/fix-update-dependency-panic
bugfix: SIGSEGV with OCI chart reference using helm template
2023-07-12 18:00:41 -07:00
Matt Farina
03911aeab7
Merge pull request #12036 from mattfarina/bump-version-3.12 2023-06-27 22:27:56 -04: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
Joe Julian
ad1fd058ad
Merge pull request #10602 from hown3d/lowercase-search
fix(search): print repo search result in original case
2023-05-26 08:32:49 -07:00
Joe Julian
d7805e68ae
Merge pull request #11455 from ksankeerth/dev-11451
Strict file permissions for repository.yaml
2023-05-25 11:25:19 -07:00
Joe Julian
49805f09b5
Merge branch 'main' into lowercase-search
Signed-off-by: Joe Julian <me@joejulian.name>
2023-05-10 16:41:11 -07:00
Joe Julian
126e4f4af8
tests: change crd golden file to match after #11870
Signed-off-by: Joe Julian <me@joejulian.name>
2023-05-09 16:04:32 -07:00
Matt Farina
1800554452
bump version to v3.12.0
(cherry picked from commit 54a0fac9b5e243d9922dbfb412bff17eb161e361)
Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-05-01 14:08:09 -04:00
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
Matt Farina
9705369da6
Merge pull request #11973 from joejulian/quiet_lint
fail quiet linting when an error occurs
2023-04-28 14:53:04 -04:00
Matt Farina
0833318b32
Merge pull request #9182 from pscheid92/4030-provide-literal-alternative-for-set-flag
Provide an alternative for --set and/or --set-string to take a value literally
2023-04-28 14:39:41 -04:00
Matt Farina
3b74c13768
Merge pull request #11479 from MichaelMorrisEst/cascade
Add option to support foreground cascade deletion
2023-04-27 15:43:14 -04:00
Joe Julian
f13fa07793
create failing test for quietly linting a chart that doesn't exist
Signed-off-by: Joe Julian <me@joejulian.name>
2023-04-10 09:22:24 -07: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
50c22ed7f9
Bump the Go version
Needed to gofmt source to meet changes in style

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-03-22 11:29:26 -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
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
154f37efec
Added insecure option to login subcommand
Signed-off-by: Andrew Block <andy.block@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
Matt Farina
5abcf74227
Merge pull request from GHSA-pwcw-6f5g-gxf8
Update to func handling
2023-02-08 11:34:57 -05:00
Matt Farina
863bc74e5a
Update to func handling
Signed-off-by: Matt Farina <matt@mattfarina.com>
2023-02-03 15:36:32 -05:00
MichaelMorris
830d4a9ee9 Add option to support cascade deletion options
Add --cascade=<background|foreground|orphan> option to helm uninstall
Current behaviour is hardcoded to background

Addresses issue: https://github.com/helm/helm/issues/10586

Signed-off-by: MichaelMorris <michael.morris@est.tech>
2023-02-02 11:22:32 +00:00
Matt Farina
5bf273d81b
Merge pull request #11487 from yxxhero/fix_template_with_output_dir
fix template --output-dir issue
2023-02-01 13:19:13 -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
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
5ec7913fd4 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:38:41 -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
fc16ea7d44 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
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
Matt Farina
36e18fa6e1
Fix improper use of Table request/response to k8s API
Fixes #11712

A change was made that when validation was turned off the Kubernetes
packages were building objects as a Table type. This was done for
display purposes. When details about the objects was going to be
printed as part of #10912.

This broke rollback, and possibly other functionality, as a Table
type was returned in some cases that needed the regular object.
This caused things to break silently.

The fix involved adding in a new Function (and interface) to
query for tables instead of the objects themselves. There was not
a clean way to add it to the existing function that covered all
cases.

A second problem was noticed along the way. When data was output
via status as YAML or JSON it was in the form of a table rather
than the objects themselves. This did not reflect expectations
and did not match the functionality in kubectl. The code was
updated to return a table when that was presented and the objects
when they are being output for YAML or JSON. The API also supports
this handling to SDK users can replicate this functionality.

API changes made here were never released. The functions were
developed for this release of Helm and only ever appeared in an
RC. In this case, they can be changed.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-01-12 08:38:10 -05:00
Matt Farina
6facbada26
bump version to v3.11.0
Signed-off-by: Matt Farina <matt.farina@suse.com>
(cherry picked from commit 9d8fee155b)
2023-01-09 21:23:22 -05:00
Matt Farina
6487d43965
Merge pull request #11672 from VaibhavSharma-47/feature
[CMD/PKG] Adopted resource not replaced when using upgrade --install --force
2023-01-09 20:48:08 -05:00
yxxhero
1c25a1fadd fix template --output-dir issue
Signed-off-by: yxxhero <aiopsclub@163.com>
2023-01-10 07:35:35 +08:00
Matt Farina
946967ffd1
Merge pull request #11490 from learnitall/pr/learnitall/allow-csv-api-versions
Add support for CSVs in template --api-versions arg
2023-01-09 17:58:51 -05:00
Matt Farina
6611cdcd01
Merge branch 'main' into 4030-provide-literal-alternative-for-set-flag
Signed-off-by: Matt Farina <matt@mattfarina.com>
2023-01-03 09:06:14 -05: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
Soujanya Mangipudi
038cc4a0ca
Merge branch 'main' into main
Signed-off-by: Soujanya Mangipudi <somangip@microsoft.com>
2022-12-12 10:48:20 -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
Cyril Jouve
1535ad5671
redirect registry client output to stderr
Signed-off-by: Cyril Jouve <jv.cyril@gmail.com>
2022-10-27 21:02:56 +02:00
shankeerthan-kasilingam
33121a80ff strict file permissions of repository.yaml
Fixes #11451

Signed-off-by: shankeerthan-kasilingam <shankeerthan1995@gmail.com>
2022-10-24 06:36:07 +05:30
Matt Farina
37dd72729b
Merge pull request #11336 from mattfarina/bump-version-3.10
bump version to v3.10.0
2022-10-03 09:32:13 -04:00
Patrick Scheid
451603910e feature(helm): add --set-literal flag for literal string interpretation
The current family of '--set' methods interprets some special characters
in values (e.g. commas, square brackets, points, backslashes). With the
typical shell escaping rules, this can increase the difficulty of overwriting
values in some cases.

In contrast to '--set-string' or similar methods, '--set-literal' does
not interpret those special characters. It interprets given values as
literal strings.

Example:

    --set-literal outer.inner='so\me,values'

    outer:
      inner: so\me,values

Closes #4030

Signed-off-by: Patrick Scheid <p.scheid92@gmail.com>
2022-09-23 13:35:48 +02:00