Commit Graph

25 Commits

Author SHA1 Message Date
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