Commit Graph

49 Commits

Author SHA1 Message Date
Alex Johnson f69a2dd03e Fix race condition in TestInstallRelease_Wait_Interrupted test
Signed-off-by: Alex Johnson <hello@alex-johnson.net>
2024-06-19 07:00:41 -05: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
Joe Julian 99b8f443d1
Merge pull request #11387 from zak905/fix_post_install_hook_issue
fix post install hook deletion due to before-hook-creation policy
2024-01-05 15:44:20 -08: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
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
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
zak905 fa025fc28b fix post install hook deletion due to before-hook-creation policy
Signed-off-by: zak905 <zakaria.amine88@gmail.com>
2023-02-09 21:46:05 +01: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
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
Dmitry Chepurovskiy f1700e86d1
Added unit tests for implemented install/upgrade labels logic
Signed-off-by: Dmitry Chepurovskiy <dm3ch@dm3ch.net>
Signed-off-by: Dmitry Chepurovskiy <me@dm3ch.net>
2022-06-17 21:36:41 +03:00
Eng Zer Jun 2e3e22a003
test: use `T.TempDir` to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-02-12 13:54:54 +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
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
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 7bfb2a3602 Improve tests
Rename the package time
Redesgin the logic to make a FakeKubeClient wait for a ammount time.
Remove unneed logic in the PrintingKubeClient

Signed-off-by: Stephane Moser <moser.sts@gmail.com>
2021-07-15 10:26:49 +01:00
Stephane Moser 660183d659 Add test for atomic upgrade and install when it is interrupted
Add tests when the install release is Interrupted and the flag Wait or Atomic is set

Signed-off-by: Stephane Moser <moser.sts@gmail.com>
2021-07-04 12:07:31 +01:00
Joe Lanford f57c01cd93
update test expectation for new template error string
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
2021-02-18 11:29:22 -05:00
Matt Farina f5ef87b96e
Merge pull request #8363 from zh168654/master
helm upgrade with --wait support jobs in manifest to be completed
2020-12-17 15:51:04 -05:00
Matt Farina fb0345a07f Updating to sprig 3.2.0
Note, randInt is now a function in sprig so the failing test needed
to be updated to a function that does not exist.

Signed-off-by: Matt Farina <matt@mattfarina.com>
2020-12-14 14:33:31 -05:00
zh168654 957d2a2bf9 add wait-for-jobs flag
Signed-off-by: zh168654 <zhangye.168@163.com>
2020-11-03 22:07:24 +08: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
Matt Butcher bb47286f09
fix linting error with lookup function (#7969)
Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2020-04-22 10:09:34 -06:00
Martin Hickey 7b9dc71c25 Fix render error not being propogated
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2020-02-14 15:54:30 +00: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
Lennard Eijsackers a3f00fde69 fix(helm): Validate number of arguments in install client
The 'helm install' command returned confusing error messages if a flag was misspecified (e.g. `helm install name chart --set value foo`). This lead to an error indicating that a name should be specified for the command. Now an explicit check is done on the number of arguments passed, returning a message indicating the invalid arguments (`foo` in the example`).

Closes #7225

Signed-off-by: Lennard Eijsackers <lennardeijsackers92@gmail.com>
2019-12-16 18:14:06 +01:00
Daniel Strobusch 8889625af6
fix: change error message to contain correct field name
When reporting an incompatible Kubernetes version, due to a version constraint from the kubeVersion field, the error message should report with the correct field name.

Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
2019-11-13 18:29:48 +01:00
Matthew Fisher bf012282c8
fix(action): strip file extensions from name
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-10-30 14:43:56 -07:00
Karuppiah Natarajan dfed8ab5e3
fix install storing computed values in release
this was partially fixed in #6430 but the fix only
worked for values without nesting. this PR fixes it.
this is done by doing a deep copy of values rather
than a top level keys copy. deep copy ensures
values are not mutated during coalesce()
execution which leads to bugs like #6659

the deep copy code has been copied from:

https://gist.github.com/soroushjp/0ec92102641ddfc3ad5515ca76405f4d

which is in turn inspired by this stackoverflow answer:
http://stackoverflow.com/a/28579297/1366283

Signed-off-by: Karuppiah Natarajan <karuppiah7890@gmail.com>
2019-10-17 16:37:19 +05:30
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
Martin Hickey 26dacf84aa
feat(cmd): Port child NOTES.txt rendering to Helm 3 (#6512)
* Port Helm 2 PR 4088 to Helm 3

Not a direct port as is but refactored for Helm 3.

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

* Update unit test to test string retunred for different order

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2019-09-30 16:40:33 +01:00
Karuppiah Natarajan 25324ca8db
fix install storing computed values in release instead of user supplied values
Signed-off-by: Karuppiah Natarajan <karuppiah7890@gmail.com>
2019-09-14 20:34:48 +05:30
Jacob LeGrone 08b2d8a2dc
Merge branch 'dev-v3' of https://github.com/helm/helm into test-as-hook 2019-08-06 14:01:00 -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
Jacob LeGrone caa4240a30
refactor(release): track test executions via Hook type
Signed-off-by: Jacob LeGrone <git@jacob.work>
2019-07-31 15:33:56 -04:00
Matthew Fisher 7de91248ce
feat(template): introduce --validate
This feature flag allows `helm template` to be used against a live cluster. Some charts need CRDs to be applied to the cluster before calling `helm install`. This allows users to validate their templates will render with those resources set.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-07-19 12:27:14 -07:00
Taylor Thomas 2c397b6879
Merge pull request #6011 from thomastaylor312/feat/atomic
feat(*) Adds atomic flag to v3
2019-07-18 10:14:21 -06:00
Torsten Walter ec038337a4
support writing multiple resources to the same file
Signed-off-by: Torsten Walter <mail@torstenwalter.de>
2019-07-17 17:55:50 +02:00
Taylor Thomas 29c343278e feat(action): Refactors unit tests with better fakes
This also adds unit tests for the Atomic and Wait functionality

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-07-11 14:45:05 -06:00
Taylor Thomas 93d07c862d feat(*): Adds back --atomic functionality to Helm 3
This does not include the cleanup on fail logic as that will be reintroduced
in a future PR

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-07-11 14:45:00 -06:00
Torsten Walter 0528c7bb19 add test for output-dir
Signed-off-by: Torsten Walter <mail@torstenwalter.de>
2019-06-03 12:45:39 +02:00
Adam Reese 0338576fc5
ref(pkg/kube): cleanup kube client interface
* move the main interface to it's own file
* removed summarizeKeptManifests() which was the last place kube.Get()
  was called
* when polling for hooks, use external types
* refactor out legacyschema
* refactor detecting selectors from object
* refactor creating test client

Signed-off-by: Adam Reese <adam@reese.io>
2019-05-15 12:31:47 -07:00
Adam Reese 895e9192d4
feat(*): use vanity import helm.sh/helm
Signed-off-by: Adam Reese <adam@reese.io>
2019-03-13 13:43:47 -07:00
Matthew Fisher 2571dbf82f
ref: remove pkg/helm, pkg/hapi, pkg/tiller
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-03-12 09:47:12 -07:00
Matt Butcher 425f7a6f6c
feat: add 'pkg/action' for list operations (#5077)
* feat: add pkg/action to encapsulate action logic

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* feat: replace client/server internals with action package

While we removed Tiller, we left the internal client/server architecture mostly intact. This replaces that architecture with the `pkg/action` package.

This implements the action package for list, but nothing else.

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* feat: Add install and refactor some tests

This adds install to the action package, and then fixes up a lot of testing.

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* fix: Move a bunch of sorters to the releaseutils package

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* fix: updated APIs and fixed a failed test

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>

* Use var for timestamper, instead of adding as a struct field

Signed-off-by: Matt Butcher <matt.butcher@microsoft.com>
2019-01-07 17:45:14 -07:00