This is the fix for only one particular, but important case.
The case when a new resource has been added to the chart and
there is an error in the chart, which leads to release failure.
In this case after first failed release upgrade new resource will be
created in the cluster. On the next release upgrade there will be the error:
`no RESOURCE with the name NAME found` for this newly created resource
from the previous release upgrade.
The root of this problem is in the side effect of the first release process,
Release invariant says: if resouce exists in the kubernetes cluster, then
it should exist in the release storage. But this invariant has been broken
by helm itself -- because helm created new resources as side effect and not
adopted them into release storage.
To maintain release invariant for such case during release upgrade operation
all newly *successfully* created resources will be deleted in the case
of an error in the subsequent resources update.
This behaviour will be enabled only when `--cleanup-on-fail` option used
for `helm upgrade` or `helm rollback`.
Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
Normally zsh arrays start at index 1 but when emulating other shells
this may change. During completion, we run the command
emulate -L sh
which affects the indexing of zsh arrays to make it start at 0.
Consequently, when replacing FUNCNAME by funcstack, we should not
change the index.
Signed-off-by: Marc Khouzam <marc.khouzam@ville.montreal.qc.ca>
Cobra provides some out-of-the-box debugging for bash completion.
To use it, one must set the variable BASH_COMP_DEBUG_FILE to
some file where the debug output will be written. Many of the
debug printouts indicate the current method name; they do so
by using bash's ${FUNCNAME[0]} variable. This variable is
different in zsh. To obtain the current method name in zsh
we must use ${funcstack[1]}.
This commit adds the proper sed modification to convert from
bash to zsh.
Signed-off-by: Marc Khouzam <marc.khouzam@ville.montreal.qc.ca>
Although it is spelling mistakes, it might make an affects
while reading.
Co-Authored-By: Dao Cong Tien tiendc@vn.fujitsu.com
Signed-off-by: Nguyen Hai Truong <truongnh@vn.fujitsu.com>
While adding the test, noticed a race in the repo update code, due to
multiple go routines potentially incrementing the error counter.
Included the required mutex in the repo update code in the same commit,
since the new test uncovered the race condition.
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
* added warning and set default image for unreleased versions of helm
* changed to BuildMetadata
* changed to BuildMetadata
* added check for clientOnly flag
While deving at a Microsoft Open Hack my group discovered this useful piece of information in this issue comment: https://github.com/helm/helm/issues/1796#issuecomment-311385728
We found it very useful for our Blue Green CD pipeline and thought others might find it useful as well.
Signed-off-by: Ethan Arrowood <ethan.arrowood@gmail.com>
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
Add possibility to put "--safe" argument to install and
upgrade command that restores the state of cluster in
case of failed install/upgrade attempt
Signed-off-by: Alexander Nesterenko <nestorf250@gmail.com>
As noted in Slack by a community member, release names with periods are
considered usable. Switching to RFC 1123 subdomain verification
continues to block bad release names like BAD_NAME, but allows names
like good.name to continue working.
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
* Refactor test run to separate method
This will allow us to parallelise it more easily
Signed-off-by: Frank Hamand <frankhamand@gmail.com>
* Add --parallel flag to helm test
(No functionality in this commit)
Signed-off-by: Frank Hamand <frankhamand@gmail.com>
* Run helm tests in parallel with --parallel flag
Signed-off-by: Frank Hamand <frankhamand@gmail.com>
* Add a mutex to helm test message streams
This is to protect against data races when running tests in parallel.
Signed-off-by: Frank Hamand <frankhamand@gmail.com>
* Add tests for --parallel flag
Signed-off-by: Frank Hamand <frankhamand@gmail.com>
* Add concurrency limit for parallel helm tests
Signed-off-by: Frank Hamand <frankhamand@gmail.com>
* Add test for concurrency limit
Signed-off-by: Frank Hamand <frankhamand@gmail.com>
* Fix rebase introduced errors
Signed-off-by: Frank Hamand <frankhamand@gmail.com>
Make the current check for the number of templates on create more
resilient by using a varible to store the expected number
of templates. In addition, fix the error message so that it displays
the correct number expected of templates.
Closes#5009
Signed-off-by: Henry Nash <henry.nash@uk.ibm.com>
When a user specifies value overrides for list values out of order,
strvals.listItem panics. Change strvals.listItem to handle this case by
re-initializing nil values to a new map.
Closes#4503
Co-authored-by: Cameron Childress <cameron@cchildress.org>
Co-authored-by: Kevin Collette <hal.collette@gmail.com>
Co-authored-by: Connor McKelvey <connormckelvey@gmail.com>
Co-authored-by: Dan Winter <dan.j.winter@gmail.com>
Signed-off-by: Dan Winter <dan.j.winter@gmail.com>
Signed-off-by: Cameron Childress <cameron@cchildress.org>
Signed-off-by: Kevin Collette <hal.collette@gmail.com>
Signed-off-by: Connor McKelvey <connormckelvey@gmail.com>
When 'helm <install|upgrade> --render-subchart-notes ...' is run, this will include
the notes from the subchart when rendered via Tiller.
Closes#2751
Signed-off-by: jgleonard <jgleonard@gmail.com>
* feat(helm): add $HELM_KEY_PASSPHRASE environment variable for signing helm charts
If $HELM_KEY_PASSPHRASE is set then helm package sign command will not prompt the
user to enter the passphrase for the private key
Signed-off-by: Anumita Shenoy <ansheno@microsoft.com>
* docs(helm): added documentation for HELM_KEY_PASSPHRASE
Added description for HELM_KEY_PASSPHRASE
Signed-off-by: Anumita Shenoy <ansheno@microsoft.com>
* fix(helm): fix regression with TLS flags/envvars
This change fixes some of the assumptions made in an earlier commit. Helm's TLS flags and environment variables were not respected because they were parsed well before execution (during settings.AddFlagsTLS()), causing erroneous behaviour at runtime. By re-introducing environment.Init(), Helm can properly parse environment variables at the correct time.
One change that had to occur in this PR is the fact that we need to call settings.Init() each time we call settings.AddFlagsTLS(). This is because each command owns its own FlagSet, so we need to parse each flagset to read and propagate the environment variables correctly.
I also noticed that we were maintaining two separate variables for each TLS value. Refactoring out some of the older code to all use the settings object makes the code much cleaner to read and fixes an issue where setting a flag or environment variable would propagate to the settings object, but we'd be reading from tlsEnable.
I've also added some unit tests to ensure this regression doesn't occur again.
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
* fix bug where os.ExpandEnv() on the default value causes differing behaviour
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
* add more context to the TODO/FIXME messages
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
* fix(helm): Use env to locate bash
Leverage '/usr/bin/env bash` for find bash instead of hardcoding
'/bin/bash' since some *nix OSes have it installed elsewhere.
Signed-off-by: Robert James Hernandez <rob@sarcasticadmin.com>
* test(helm): Adding case for versions short flag
When git sha is empty if being built from tarball running 'helm version
--short' should just ignore '--short' since sha is empty. Adding test
to ensure this is the case.
Signed-off-by: Robert James Hernandez <rob@sarcasticadmin.com>
* fix(helm): ignore short flag when sha is empty
Signed-off-by: Robert James Hernandez <rob@sarcasticadmin.com>