46 Commits
Author SHA1 Message Date
Oleg Sidorov 4cddc82c0b Reverted changes introduced in #6010
This commit reverts changes introduced in #6010 due to a massive
regression reported in #6708. An attempt to fix the problem in
https://github.com/helm/helm/pull/6709 seems to be unreasonably clumzy
and hacky, therefore reverting the offensive change seems to be the most
pragmatic solution.

This reverts commits:
  * 70cd32c4ce.
  * 9014bd9c50.

Signed-off-by: Oleg Sidorov <me@whitebox.io>
2019-10-22 22:26:38 +02:00
Stefan Deitmer e53613db3f Fix subchart values not being deleted by setting value to nil in parent chart's values
Signed-off-by: Stefan Deitmer <stefan.deitmer@gec.io>
2019-07-25 14:29:45 +02:00
Oleg Sidorov 9014bd9c50 chartutil.ReadValues is forced to unmarshal numbers into json.Number
This change is an attempt to address the common problem of json number
unmarshalling where any number is converted into a float64 and
represented in a scientific notation on a marshall call. This behavior
breaks things like: chart versions and image tags if not converted to
yaml strings explicitly.

An example of this behavior: k8s failure to fetch an image tagged with a
big number like: $IMAGE:20190612073634 after a few steps of yaml
re-rendering turns into: $IMAGE:2.0190612073634e+13.

Example issue: https://github.com/helm/helm/issues/1707

This commit forces yaml parser to use JSON modifiers and explicitly
enables interface{} unmarshalling instead of float64. The change
introduced might be breaking so should be processed with an extra care.

Due to the fact helm mostly dals with human-produced data (charts), we
have a decent level of confidence this change looses no functionality
helm users rely upon (the scientific notation).

Relevant doc: https://golang.org/pkg/encoding/json/#Decoder.UseNumber

Signed-off-by: Oleg Sidorov <oleg.sidorov@booking.com>
2019-07-11 15:12:02 +02:00
Adam Eijdenberg 0ba4c63546 Update warning to be more accurate
Signed-off-by: Adam Eijdenberg <adam.eijdenberg@digital.gov.au>
2019-06-12 10:06:50 +10:00
Adam Eijdenberg dda84976bf Refactor to use common codepath for table coalescing
Stop mutating maps passed on input

Signed-off-by: Adam Eijdenberg <adam.eijdenberg@digital.gov.au>
2019-06-12 10:06:50 +10:00
Adam Eijdenberg 5b9311d163 Fix nested null value overrides
- Add ability to test for nested non-existent keys
- Add test cases for nested null values
- Minimalist fix for nested null key test cases
- Add missing metadata to integration test

Signed-off-by: Adam Eijdenberg <adam.eijdenberg@digital.gov.au>
2019-05-31 16:23:54 +10:00
Martin Hickey 58be8e461c Update messaging in value parsing to improve traceability (#4974)
Closes #4736

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2018-11-30 10:04:37 -08:00
Morten Torkildsen 82d01cb312 fix(helm): Merge nested values correctly on upgrade (#4806)
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>
2018-11-12 12:32:21 +01:00
Matthew Fisher 2d77db11fa change copyright to "Copyright The Helm Authors" 2018-07-30 08:29:17 -07:00
Steven E. Harris e8d80729ac Merge pull request #2703 from rbwsam/ref/simplify_error
ref(pkg/chartutil): replace use of 'fmt.Efforf'
2017-07-25 10:14:32 -04:00
Sam Leavens 098df8b186 ref(pkg/chartutil): improve comment spacing
Reduce comment spacing to single tab.
2017-07-20 14:21:40 -07:00
Sam Leavens f7ca52dfc8 ref(pkg/chartutil): improve comment for PathValue
Make comment for PathValue more explanatory.
2017-07-20 13:59:28 -07:00
Sam Leavens 8df52b6501 ref(pkg/chartutil): move comment
Move comment out of test. Move ref location in test.
2017-07-20 13:10:59 -07:00
Sam Leavens 3ee70291c8 ref(pkg/chartutil): Capitalize YAML
Capitalize "yaml" in error message. Remove empty var from test error message.
2017-07-20 11:52:49 -07:00
Sam Leavens 51b59497ee ref(pkg/chartutil): decrease map lookups
Decrease map lookups in `chartutil.coalesceValues` and move comment to unit
test.

Closes #2663
2017-07-19 17:55:11 -07:00
Sam Leavens 9b8928edf4 ref(pkg/chartutil): replace use of 'fmt.Efforf'
'fmt.Errorf' is unnecessary when checking for 0 length path in Values.PathValue
due to the lack of formatting. Add test covering changes.
2017-07-19 15:53:12 -07:00
Scott Rigby 645f01eb22 New Helm functionality to delete a coalesced YAML key when the value is nil.
- Note that this covers all YAML null syntax options:
  ref: http://yaml.org/type/null.html
- Note that we do a nil comparison because the encoding/yaml package parses
  YAML properly and any variation of null, Null, NULL, or ~ is converted to nil
  by the time we get here.
2017-07-07 14:32:56 -04:00
Justin Scott 58c8aca1cc feat(helm): fixup if/ele,remove extra string casts, add comments 2017-02-11 12:56:43 -08:00
Justin Scott faae1f68b6 feat(helm): Check len of correct slice 2017-02-11 12:56:43 -08:00
Justin Scott 8ef733ca7d feat(helm): add conditions and tags
This feature adds the ability to selectively control the loading of charts using entries in top chart's values.
When 'helm install --set tags.mytag=true', charts with that tag will be enabled unless disabled in parent by condition.
When 'helm install --set mychart.enabled=true', charts with that yaml path specified will be enabled.

Closes #1837
2017-02-11 12:56:43 -08:00
Matt Butcher cb0a6c7e07 feat(tiller): add {{.Capabilities}} object
This adds the {{.Capabilities}} object to the template variables so that
chart authors can write charts that are aware of teh Kubernetes
capabilities of the current cluster.

Closes #1608
2017-01-09 18:09:20 -07:00
Matt Butcher b3d812b346 Merge pull request #1692 from technosophos/fix/allow-global-map-merges
fix(tller): allow deep merge of global maps
2016-12-16 16:29:13 -07:00
Matt Butcher 6faf4675ac fix(tller): allow deep merge of global maps
This reverts a previous decision to only do shallow merges of globals.
It allows globals to be nested maps.
2016-12-15 17:06:30 -07:00
Matt Butcher b2d762af48 feat(tiller): add .Release.IsInstall 2016-12-15 15:04:36 -07:00
Matt Butcher de7c5e5a38 feat(tiller): Add .Release.Revision and .IsUpgrade
New properties are available to template developers.

Closes #1554
2016-12-14 18:06:34 -07:00
Adam Reese e2ab407209 fix(tiller): return yaml parsing errors
closes: #1519
2016-11-14 14:30:33 -08:00
Matt Butcher 033dbfe75e feat(tiller): add Files map to templates
Templates can now access the non-template files in a chart by using
the '{{.Files}}' map inside of a template.

Relates to #950
2016-07-29 16:04:48 -06:00
Matt Butcher 95eeba3805 fix(tiller): merge -f values correctly
This fixes a bug in which passed-in values files were not correctly
merged into the chart's default values YAML data. I believe it also
fixes some other prioritization bugs in values merging.

The existing unit test was wrong (see TestCoalesceValues). It is
fixed now. Also added more tests to simulate issue #971.

In the course of writing this, I removed some vestigial code as
mentioned in #920.

Closes #971
Closes #920
2016-07-21 16:00:57 -06:00
Matt Butcher 310ef9bbcb fix(helm): fix linter test panic
Handle a previously unhandled error in the linter. This simply bails out
if a chart's values files do not parse.

Also, changed the implementation of CoalesceValues to return a map even
on error.
2016-06-30 12:51:36 -06:00
Miguel Ángel Martínez Triviño 81fd9edf4d Merge pull request #899 from migmartri/897-values-refactorign
Support Linter for Values namespace
2016-06-29 16:10:08 -07:00
Adnan Abdulhussein 9b257077d5 Merge pull request #915 from prydonius/fix/912-nil-map-readvalues
fix(chartutil): Ensure ReadValues doesn't return a nil map
2016-06-29 16:01:43 -07:00
Adnan Abdulhussein 4ef61a7136 fix(chartutil): Ensure ReadValues doesn't return a nil map 2016-06-29 15:38:53 -07:00
Miguel Martinez 12aa72f121 Replacing options interface argument 2016-06-28 19:27:20 -07:00
Matt Butcher 532f03ec78 feat(tiller): add .Template object in templates
This allows templates to access information about the template file.
Right now, the template can only access the .Template.Name, which is the
chart-relative path to the current template.

Closes #894
2016-06-28 16:18:08 -06:00
Miguel Martinez 7bb4893cad Support Linter for Values 2016-06-27 17:47:18 -07:00
Matt Butcher 90c46e896d fix(chartutil): fix Table() method to test Values
This makes the Table() method more flexible than the original version.
It allows either a map[string]interface{} or a chartutil.Values to be
treated as a table.
2016-06-24 12:06:52 -06:00
Matt Butcher 22ac61469f feat(*): add Values namespace to templates
This adds the .Values namespace qualifier to all values
2016-06-24 12:06:52 -06:00
Matt Butcher e757b24aed fix(*): add license header 2016-06-22 12:28:45 -06:00
Matt Butcher f30ff915f2 feat(helm): add 'helm get values --all' for all values
Add support for displaying computed configuration values. This is
useful for debugging.
2016-06-17 16:15:03 -06:00
Matt Butcher 2b2a5788f3 Merge pull request #824 from technosophos/feat/global-vars
feat(chartutil): support global variables
2016-06-15 12:53:30 -06:00
Matt Butcher 88622a20da fix(helm): read values.yaml instead of values.toml
Closes #822
2016-06-14 12:06:19 -06:00
Matt Butcher 60f5341b91 feat(chartutil): support global variables
This provides support for "global" variables. It does this by
declaring "global" to be a special namespace. It then copies this
namespace into every subchart, coalescing it into any "global"
namespace found there.

The net result is that if "global.foo" is set in the YAML file, it
will be available to every chart/subchart as ".global.foo" regardless of
where that chart is in the subchart tree.
2016-06-14 11:24:09 -06:00
Matt Butcher 490cef784c fix(tiller): refactor template render to use chartutil. 2016-06-13 13:11:39 -06:00
Matt Butcher e8109048a9 fix(chartutil): move values coalescing into chartutil 2016-06-09 14:10:12 -06:00
Adam Reese d95a144563 fix(chartutil): fix nil error on values
Fixes: https://github.com/kubernetes/helm/issues/803
2016-06-09 11:09:00 -07:00
Matt Butcher 7aa4ffa4d4 feat(chartutil): switch TOML to YAML 2016-06-06 21:09:27 -06:00