* 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>
* Return empty string instead of nil when linting on required
This allows lint to work in scenarios when required is used in secrets or it's output is passed to another function.
Due to lint mode no longer failing on missing value in required it is passing nil through which not all functions can accept.
Fixes#4747
Signed-off-by: Helgi Þorbjörnsson <helgith@gmail.com>
* Apply suggestions from code review
Co-Authored-By: helgi <70530+helgi@users.noreply.github.com>
Signed-off-by: Helgi Þorbjörnsson <helgith@gmail.com>
* Add tests
Signed-off-by: Helgi Þorbjörnsson <helgith@gmail.com>
This is probably a silly PR. However, each time I create a new chart
via `helm create`, the instructions to uncomment the resource limits
require adding a couple extra spaces back to the YAML.
This PR simply brings the spacing in-line with the rest of the generated
template.
Signed-off-by: John Dewey <john@dewey.ws>
Currently the code that handles hooks uses a builder that creates the versioned types rather than unstructured. This results in an error whenever a custom resource is used in the hook as the type will not be registered in the scheme used in Helm. This changes this to use a builder that created unstructured resources and only converts to the versioned type when needed.
Signed-off-by: Morten Torkildsen <mortent@google.com>
Apply the same procedure to allow missing trailing slash in repo base URLs used in `repo/chart` inputs to `--repo` inputs.
Fixes#4954.
Signed-off-by: Luke Hoban <luke@pulumi.com>
Due to a regression from a previous change, details about pod resources
does not show up in the status output. This makes sure that the pod type
from core are passed in to the printer so the details are shown in the
output.
Signed-off-by: Morten Torkildsen <mortent@google.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>
The output from helm status is not correct for custom resources. The
HumanReadablePrinter from Kubernetes only outputs the column names when
the type differs from the previous one. This makes the output
inconsistent and also creates problems for putting in the correct line
breaks. This PR sets up a new printer for each type, thereby making sure
that all types are printed with the correct use of line breaks and with
column names.
Signed-off-by: Morten Torkildsen <mortent@google.com>
Solves #3722 by making the changes in #3539 more compatible with the previous behavior.
This gives a recovery option for "oops I deleted my helm release" by allowing rollback, which is intended to be a working feature of helm. Note that purging releases removes the history required to rollback, so this doesn't work in that case. However, purging takes significantly more time, so it's harder to accidentally purge everything.
Signed-off-by: Brent <bmperrea@gmail.com>
Upgrading a release and override existing values doesn't work as expected for nested values. Maps should be merged recursively, but currently maps are treated just like values and replaced at the top level.
If the existing values are:
```yaml
resources:
requests:
cpu: 400m
something: else
```
and an update is done with ```--set=resources.requests.cpu=500m```, it currently ends up as
```yaml
resources:
requests:
cpu: 500m
```
but it should have been
```yaml
resources:
requests:
cpu: 500m
something: else
```
This PR updates the way override values are merged into the existing set of values to merge rather than replace maps.
Closes: #4792
Signed-off-by: Morten Torkildsen <mortent@google.com>
The essence of this commit is to help people get started with a better
indentation practice than this:
```yaml
spec:
labels:
{{ toYaml .Values.labels | indent 4 }}
```
The previous indentation practice is harder to read. Instead this commit
introduces an indentation practice using `nindent` like this:
```yaml
spec:
labels:
{{- toYaml .Values.labels | nindent 4 }}
```
Signed-off-by: Erik Sundell <erik.i.sundell@gmail.com>
Remove the engine `currentTemplates` field which was shared state
across threads and thus not thread safe, and instead just pass these
reference templates as parameters down recursively.
Closes#4819
Signed-off-by: Sean Eagan <sean.eagan@att.com>
While investigating a tiller crash on v2.10.0 (see recent comments in #3125), I pulled down the code
and wrote a test replicating the crash I was experiencing. I then
realized that the crash had been fixed, and was able to locate the fix
in #4630 after running a quck bisect.
Since there don't appear to be any tests that cover this crash, and I
had written one myself, I figured I might as well put up a PR for it.
Here's what the test failure on v2.10.0 looks like:
```
-- FAIL: TestUpdateReleasePendingInstall_Force (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x1d128d8]
goroutine 235 [running]:
testing.tRunner.func1(0xc420493c20)
/usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:742 +0x29d
panic(0x1eb8d80, 0x2a12db0)
/usr/local/Cellar/go/1.10/libexec/src/runtime/panic.go:505 +0x229
k8s.io/helm/pkg/tiller.(*ReleaseServer).performUpdateForce(0xc4208210b0, 0xc4202c6dc0, 0x0, 0x0, 0x2174220)
/Users/mattrasmus/go/src/k8s.io/helm/pkg/tiller/release_update.go:166 +0x188
k8s.io/helm/pkg/tiller.(*ReleaseServer).UpdateRelease(0xc4208210b0, 0x2191780, 0xc420820f30, 0xc4202c6dc0, 0x29aeb90, 0x38, 0x2d2)
/Users/mattrasmus/go/src/k8s.io/helm/pkg/tiller/release_update.go:43 +0x245
k8s.io/helm/pkg/tiller.TestUpdateReleasePendingInstall_Force(0xc420493c20)
/Users/mattrasmus/go/src/k8s.io/helm/pkg/tiller/release_update_test.go:549 +0x120
testing.tRunner(0xc420493c20, 0x20e5c70)
/usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:777 +0xd0
created by testing.(*T).Run
/usr/local/Cellar/go/1.10/libexec/src/testing/testing.go:824 +0x2e0
FAIL k8s.io/helm/pkg/tiller 0.118s
```
Signed-off-by: Matt Rasmus <mrasmus@betterworks.com>
The output from helm status does not have consistent use of line breaks.
For some resources there is a line break after the kind header, for
others there is not. This is caused by how the printer handles column
headers. This removes a line break for all but the first resource listed.
Signed-off-by: Morten Torkildsen <mortent@google.com>
Update of the client-go package changed the status output to only include
the age of resources. The new printer in client-go only formats the output
to include details of specific resources if the internal representation
of resources are passed into the printer. This PR updates helm to convert
resources to the internal type before printing.
Closes#4712
Signed-off-by: Morten Torkildsen <mortent@google.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>
Use 'apps/v1' as the apiVersion field for the deployment.yaml written
by the 'helm create' command, rather than the deprecated 'apps/v1beta2'.
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.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>