Commit graph

2452 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
e8a748d300
Updated per feedback from gjenkins8
Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-07-25 09:52:46 -04:00
Joe Julian
ca61c326c2
Merge pull request #11758 from joejulian/remove_blank_list_item_from_files_lines
strip trailing newline from Files.Lines
2023-07-24 19:16:28 -07: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
99e1dce8c8
Merge pull request #9950 from jeffrosenberg/error-on-failed-jobs-9285
Throw an error from jobReady() if the job exceeds its BackoffLimit
2023-07-13 08:21:58 -07: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
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
Joe Julian
ec1d0d8671
Merge pull request #11456 from greed42/tpl-tests
Backfill tests for the `tpl` function
2023-07-12 17:21:07 -07:00
Andrew Block
d72b42da61
Added tests for created OCI annotation time format
Signed-off-by: Andrew Block <andy.block@gmail.com>
2023-07-04 04:51:46 -05:00
Andrew Block
c4870d990c
Add created OCI annotation
Signed-off-by: Andrew Block <andy.block@gmail.com>
2023-07-02 07:21:15 -05: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
Yarden Shoham
15e6066a45 chore: fix a typo in manager.go
actally -> actually

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2023-06-25 20:07:02 +00:00
wujunwei
c87f846d88 add GetRegistryClient method
Signed-off-by: wujunwei <wjw3323@live.com>
2023-06-15 11:49:23 +08:00
Matt Farina
4e447d87cd
Merge pull request #11397 from wujunwei/fix-helm-lint-infinite-loop
bugfix: helm lint infinite loop
2023-06-14 10:38:13 -04:00
Matt Farina
c88d8969da
Merge pull request #12056 from kupnu4x/skeleton-helm-release-autoscaling-v2
update autoscaling/v2beta1 to autoscaling/v2 in skeleton chart
2023-06-13 16:06:38 -04:00
Matt Farina
1c4885fce7
Merge pull request #11501 from imanushin/add-test-for-exact-version
Add test for exact version selection
2023-05-30 12:58:14 -04: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
Graham Reed
f235f0f285 Check that missing keys are still handled in tpl
Signed-off-by: Graham Reed <greed@7deadly.org>
2023-05-11 22:16:30 +01:00
Joe Julian
17beedb49c
Merge pull request #11870 from cbodonnell/main
full source path for CRDs when output-dir is not provided
2023-05-08 17:23:07 -07:00
Dmitry Kamenskikh
b4a4c7a9d4 update autoscaling/v2beta1 to autoscaling/v2 in skeleton chart
Signed-off-by: Dmitry Kamenskikh <kupnu4x@gmail.com>
2023-05-05 13:59:11 +08: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
Matt Farina
b4b629c3c2
Merge pull request #11204 from sabre1041/oci-annotations
Attach annotations to OCI artifacts
2023-05-01 10:55:38 -04:00
Matt Farina
b81428919b
Merge pull request #12015 from yann-soubeyrand/bump-k8s-io-deps
chore: bump k8s.io dependencies to v0.27.1
2023-05-01 09:54:14 -04:00
Andrew Block
f900e9f1b1
Attach annotations to OCI artifacts
Signed-off-by: Andrew Block <andy.block@gmail.com>
2023-04-29 08:10:04 -05:00
Matt Farina
01dabe5312
Merge pull request #11948 from wujunwei/fix-failed-testcase-on-windows
fix: failed testcase on windows
2023-04-28 15:20:37 -04: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
b3707e666b
strip trailing newline from Files.Lines
Signed-off-by: Joe Julian <me@joejulian.name>
2023-04-18 16:18:36 -07:00
Tom Wieczorek
b9361407a3
Bump k8s.io deps from v0.26.0 to v0.27.0
Adapt to changes in 1.27 client libs:

* The OpenAPIGetter method is now private, but the Validator method does
  what is needed instead.
* The function wait.PollImmediateUntil is deprecated. Switch to the
  recommended new function wait.PollUntilContextCancel.

Related dependency changes:

change k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 => v0.0.0-20230308215209-15aac26d736a

And some transitive version changes:

add github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
add github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1
remove github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153
github.com/go-errors/errors v1.0.1 => v1.4.2
github.com/go-openapi/jsonpointer v0.19.5 => v0.19.6
github.com/go-openapi/jsonreference v0.20.0 => v0.20.1
github.com/go-openapi/swag v0.19.14 => v0.22.3
github.com/golang/protobuf v1.5.2 => v1.5.3
github.com/mailru/easyjson v0.7.6 => v0.7.7
github.com/onsi/ginkgo/v2 v2.4.0 => v2.9.1
github.com/onsi/gomega v1.23.0 => v1.27.4
github.com/rogpeppe/go-internal v1.9.0 => v1.10.0
golang.org/x/mod v0.8.0 => v0.9.0
golang.org/x/net v0.7.0 => v0.8.0
golang.org/x/term v0.5.0 => v0.6.0
golang.org/x/tools v0.6.0 => v0.7.0
gotest.tools/v3 v3.0.3 => v3.4.0
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 => v0.0.0-20221116044647-bc3834ca7abd
sigs.k8s.io/kustomize/api v0.12.1 => v0.13.2
sigs.k8s.io/kustomize/kyaml v0.13.9 => v0.14.1

Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
2023-04-13 10:48:42 +02:00
Matt Farina
cf3d2531a8
Merge pull request #11898 from willzgli/waitbatchPerform
Fix goroutine leak in perform
2023-04-11 11:21:21 -04:00
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
Matt Farina
10587613cf
Merge pull request #11949 from dirkmueller/goarches
Fix 32bit-x86 typo in testsuite
2023-04-10 12:26:19 -04:00
Joe Julian
853c18002f
fix quiet lint does not fail on non-linting errors
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
Aman Nijhawan
eea2f27bab
Fixes Readiness Check for statefulsets using partitioned rolling update. (#11774)
* Fixes Readiness Check for statefulsets using partitioned rolling update.
Fixes #11773

This change updates readiness check in ready.go to correctly
account for statefulsets that are utilizing a partitioned upgrade.
These statefulsets only upgrade a subset of the managed pods with each call
to helm upgrade. This causes the upgrade to legitimately hit the condition where
sts.status.CurrentRevision != sts.Status.UpdateRevision which causes helm to mark
the upgrade has failed when in fact it is successful.

This change fixes that behavior to only check when partition is unspecified or 0.

Signed-off-by: Aman Nijhawan <anijhawan@yugabyte.com>

* Adding a unit test to verify that partitioned rolling upgrade for a statefulset works.

Signed-off-by: Aman Nijhawan <anijhawan@yugabyte.com>

---------

Signed-off-by: Aman Nijhawan <anijhawan@yugabyte.com>
Co-authored-by: Aman Nijhawan <anijhawan@yugabyte.com>
2023-03-30 10:39:29 -06:00
wujunwei
878e962b23 fix: failed testcase on windows
Signed-off-by: wujunwei <wjw3323@live.com>
2023-03-29 10:27:44 +08:00
Dirk Müller
1fc8369356
Fix 32bit-x86 typo in testsuite
The GOARCH here is 386 not i386. This caused a slightly odd test
suite failure on that architecture:

--- FAIL: TestPlatformPrepareCommand (0.00s)
     plugin_test.go:45: Expected arg="os-arch", got "linux-s390x"
     plugin_test.go:64: Expected arg="os-arch", got "linux-s390x"

Signed-off-by: Dirk Müller <dirk@dmllr.de>
2023-03-28 15:10:19 +02:00
wujunwei
cd2609d08e add some test case
Signed-off-by: wujunwei <wjw3323@live.com>
2023-03-28 15:04:07 +08:00
wujunwei
8e1c3d0d39 fix comment grammar error.
Signed-off-by: wujunwei <wjw3323@live.com>
2023-03-28 15:04:07 +08:00
wujunwei
316d3fb56a bugfix:(#11391) helm lint infinite loop
when malformed template object

Signed-off-by: wujunwei <wjw3323@live.com>
2023-03-28 15:04:07 +08:00
Matt Farina
046646c944
Handle failed DNS case for Go 1.20+
Go 1.20 introduced DNS/CNAME handling changes. This can cause an
IP address represented in hex, oct, etc to be looked up as DNS and
fail. This change introduces a mock DNS resolver.

Note, with the mock resolver, we don't need to use 0x7f000001 any
longer. Keeping because it was already there.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-03-23 13:22:07 -04: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
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
willzgli
11150cdcc6 Fix goroutine leak in perform
Signed-off-by: willzgli <willzgli@tencent.com>
2023-03-17 23:30:12 +08: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