Commit graph

71 commits

Author SHA1 Message Date
wangjingcun
e4062e7e00 fix: fix label name
Signed-off-by: wangjingcun <wangjingcun@aliyun.com>
2024-11-07 17:10:31 +08:00
Matt Farina
25371e2f0d Fixing precedence issue with the import of values.
The ordering should be:
1. User specified values (e.g CLI)
2. Parent chart values
3. Imported values
4. Sub-chart values

This enables parnet charts to import large set of values from a
child and then override select values.

This change is needed for backwards compatibility.

Fixes #12460

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-10-11 14:56:12 -04:00
guoguangwu
bf543d94e9 fix: precedence typo
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-08-10 14:38:08 +08:00
Matt Farina
0a5148faff
Fix multiple bugs in values handling
First, some notes about priority and how some code flow works.

For Helm handling values, the expected order of precidence is:
1. User specified values (e.g CLI)
2. Imported values
3. Parent chart values
4. Subchart values

Helm handles dependency values slightly differently. If there are dependencies
in the charts folder that are not marked as dependencies all of the values,
including nil values, are pulled in. If those charts are listed as a
dependency in the Chart.yaml file than they are processed for import handling.
Prior to the changes here, it caused nil values at the top level to NOT remove
values specified.

The changes:

1. The order of priority was chagned from the list above. Parnet chart values
would override specifically imported values. This is due to a change from
just over a year ago that introduced a bug. That was undone by changing the
precidence when maps were merged.

2. To handle merging while retaining the nil values, which was causing
inconsistent behavior, a new set of Merge functions were introduced. These
functions are just like coalesce except that they DO NOT remove nil/null values.
The new functions are used in a backward compatible manner meaning some new
functions were introduced that called them.

Specific issues fixed (that are known):

Closes #9027

Can now delete subkeys from charts when specified in the parent. This behavior
was previously inconsistent. Sometimes they could be deleted and other times
it did not work. Now it is consistent.

Closes #10899

Imported values (from library or other subcharts) are now used following the
order above.

The previous behavior was inconsistent. import-values using just a string
would import them. When named with a child/parent it did not work if the
parent already had a value. If string and named were mixed the imports
worked if the string happened first but just for the string not the named.
If the named parent/child went first then none of them worked for cases
where the parent already had a value. It was inconsistent and the tests
sometimes mirrored the functionality rather than expected behavior.

Tests for this fall into the sub-packages and are in the template tests
to verify it's happening in the output. Including having values passed
at the CLI as the ultimate highest priority to be used.

This relates to a fix that went in for #9940. The expected values there don't
fit the precedence above where the parent value would override the imported
value. That fix/change introduced more bugs.

Closes #10052

This is the case where imported values using the parent/child designation
just didn't work right. That has been fixed and there are tests. The underlying
issue had to do with the precedence order handling.

Note, a lot of tests were added. Hope we got it more right this time.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-06-26 11:37:21 -04:00
Martin Hickey
775af2a0ce Update schema validation handling
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2022-10-21 18:04:05 +01:00
Aram Zegerius
752aa6d462 Simplify testdata charts
Signed-off-by: Aram Zegerius <aram@zegeri.us>
Signed-off-by: Ankita Bhopatkar <ankitabhopatkar13@gmail.com>
2021-09-14 10:34:35 +02:00
Aram Zegerius
3fd4a11b18 Simplify testdata charts
Signed-off-by: Aram Zegerius <aram@zegeri.us>
Signed-off-by: Ankita Bhopatkar <ankitabhopatkar13@gmail.com>
2021-09-14 10:27:50 +02:00
Aram Zegerius
4b49f356a9 Add tests for multi-level dependencies.
Closes #9940

Signed-off-by: Aram Zegerius <aram@zegeri.us>
Signed-off-by: Ankita Bhopatkar <ankitabhopatkar13@gmail.com>
2021-09-10 15:49:05 +02:00
Josh Soref
2bf8fdf45d
chore: Spelling (#9410)
* spelling: annotate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: asserts

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: behavior

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: binary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: contain

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: copied

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: depending

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deprecated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: doesn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: donot

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: github

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inputting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iteration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: jabberwocky

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kubernetes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: length

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: mismatch

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: nonexistent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: outputs

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: panicking

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: plugins

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parsing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: porthos

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: regular

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: resource

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repositories

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: something

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: strict

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: string

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-15 21:11:57 -04:00
Adam Reese
3364265e78
ref(pkg/chartutil): use minimal in-memory fixtures
Signed-off-by: Adam Reese <adam@reese.io>
2020-05-15 12:11:18 -07:00
uzxmx
a34f311539
Fix nested null value overrides (#7743)
* Fix nested null value overrides

Signed-off-by: Mingxiang Xue <mingxiangxue@gmail.com>

* Fix subchart value deletion

Signed-off-by: Mingxiang Xue <mingxiangxue@gmail.com>
2020-04-16 13:53:39 -06:00
Mario Valderrama
6414791e08
Improve --show-only flag (#7816)
* Improve --show-only flag
* Ensure consistent manifest ordering
2020-04-02 14:09:45 -07:00
Florian Hopfensperger
d03db32c25 fixed dependencies processing in case of helm install or upgrade for disabled/enabled sub charts
Signed-off-by: Florian Hopfensperger <f.hopfensperger@gmail.com>
2020-02-03 11:30:26 +01:00
Josh Soref
02ad2b1187 Spelling (#7258)
* spelling: constraint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cryptographic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependency

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: doesnot

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: don't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unexpected

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dreadnought

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: default

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: envvars

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: evaluates

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: execute

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: extractor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: frobnitz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implementation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: jabba

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: keywords

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: kubernetes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: override

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: package

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parsable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: progress

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recursively

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: release

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cache

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: representing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: serializer

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subchart

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: utilities

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2019-12-18 12:04:08 +00:00
Graham Goudeau
01aa1bd3a2 Add a flag to allow template to output CRDs
Signed-off-by: Graham Goudeau <graham.goudeau@solo.io>
2019-12-03 14:06:55 -05:00
Oleg Sidorov
44a81f63f7 Revert "chartutil.ReadValues is forced to unmarshal numbers into json.Number refs #1707 [dev-v3]"
This reverts commit f94bac0643.

Due to a major numeric regression detected in dev-v2 reported in #6708,
we believe the master branch (former dev-v3) is also impacted by this
change and will expose the same set of problems. In order to not
jeopardize the stability of helm3 this commit is reverted in favor of a
better fix in the future.

Signed-off-by: Oleg Sidorov <me@whitebox.io>
2019-10-23 09:27:51 +02:00
Taylor Thomas
59d3488d1c feat(template): Ports api-versions flag to v3
This is a port of #5392. It also takes care of the small chore to update the default k8s
version to 1.16, which is the latest supported version

Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
2019-10-07 13:30:06 -06:00
Matthew Fisher
37f7cc0851
Merge pull request #4917 from derkoe/dev-v3-fix-requirement-condition
fix(pkg/chartutil): conditions for alias and umrella charts (#3734)
2019-09-30 14:50:19 -07:00
Matthew Fisher
4f6d002d6c
chore(docs): move docs to helm-www
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-07-22 12:15:35 -07:00
Oleg Sidorov
f94bac0643 chartutil.ReadValues is forced to unmarshal numbers into json.Number refs #1707 [dev-v3]
Backport of https://github.com/helm/helm/pull/6010 to dev-v3 (the
description below is a copy-paste from the original v2 branch PR).
As https://github.com/helm/helm/pull/6016 is now merged to dev-v3, the
change is reasonably trivial.

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: #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>
Signed-off-by: Oleg Sidorov <me@whitebox.io>
2019-07-17 10:30:51 +02:00
Adam Reese
b7a14de590
Merge pull request #5601 from adamreese/v3/capabilities
ref(pkg/chartutil): remove k8s version object dependency
2019-05-09 14:29:34 -07:00
Adam Reese
097834de0a
ref(pkg/chartutil): remove k8s version object dependency
Flattens the `.Capabilities` built-in and removes useless kubernetes
runtime metadata.

Signed-off-by: Adam Reese <adam@reese.io>
2019-05-07 13:49:05 -07:00
Matt Farina
250b63eced
Updating the labels for consistency
Signed-off-by: Matt Farina <matt@mattfarina.com>
2019-05-07 14:13:29 -04:00
Matt Farina
af7eab0325
Updating to the k8s label convention
Closes #4335

Signed-off-by: Matt Farina <matt@mattfarina.com>
2019-05-07 11:26:31 -04:00
Ian Howell
ffff0e8c33 Feat/schema validation (#5350)
* Add the Schema type and a function to read it

* Added a function to read a schema from a file

* Check that values.yaml matches schema

This commit uses the gojsonschema package to validate a values.yaml file
against a corresponding values.schema.yaml file.

* Add functionality to generate a schema from a values.yaml

* Add Schema to Chart and loader

* Clean up implementation in chartutil

* Add tests for helm install with schema

* Add schema validation to helm lint

* Clean up "matchSchema"

* Modify error output

* Add documentation

* Fix a linter issue

* Fix a test that broke during a rebase

* Clean up documentation

* Specify JSONSchema spec

Since JSONSchema is still in a draft state as of this commit, we need to
specify a particular version of the JSONSchema spec

* Switch to using builtin functionality for file extensions

* Switch to using a third-party library for JSON conversion

* Use the constants from the gojsonschema package

* Updates to unit tests

* Minor change to avoid string cast

* Remove JSON Schema generation

* Change Schema type from map[string]interface{} to []byte

* Convert all Schema YAML to JSON

* Fix some tests that were broken by a rebase

* Fix up YAML/JSON conversions

* This checks subcharts for schema validation

The final coalesced values for a given chart will be validated against
that chart's schema, as well as any dependent subchart's schema

* Add unit tests for ValidateAgainstSchema

* Remove nonessential test files

* Remove a misleading unit test

The TestReadSchema unit test was simply testing the ReadValues function,
which is already being validated in the TestReadValues unit test

* Update documentation to reflect changes to subchart schemas
2019-04-26 08:45:03 -07:00
Adam Reese
e458a67f0c
ref(pkg/chart): add validation method to chart
Consolidate validation of Chart.yaml.

Signed-off-by: Adam Reese <adam@reese.io>
2019-04-05 13:40:06 -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
95c865513f
fix appveyor builds (#4934)
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2019-01-31 21:31:09 -08:00
Christian Koeberl
62533e2b0e fix(pkg/chartutil): conditions for alias and umrella charts (#3734)
Enable to use charts with dependencies that have conditions (e.g. in
umbrella charts). Allow aliases for dependencies that have dependencies
with conditions.

Closes #3734

Signed-off-by: Christian Koeberl <christian.koeberl@gmail.com>
2018-12-17 11:19:56 +01:00
Adam Reese
6fc8c9e079
ref(pkg/chartutil): simplify chart dependency unit tests
- simplify unit tests
- refactor typed errors
- unexport internal functions

Signed-off-by: Adam Reese <adam@reese.io>
2018-11-29 10:30:52 -08:00
Adam Reese
85aef0d3d7
ref(pkg/chart): rename Requirements to Dependencies
Signed-off-by: Adam Reese <adam@reese.io>
2018-11-28 10:20:33 -08:00
Adam Reese
21259507bd
ref(*): rename requirements.lock to Chart.lock
Signed-off-by: Adam Reese <adam@reese.io>
2018-08-29 14:43:37 -07:00
Adam Reese
f7a7a157ce
ref(*): merge requirement.yaml into Chart.yaml
Signed-off-by: Adam Reese <adam@reese.io>
2018-08-29 14:05:37 -07:00
Adam Reese
aa859e3f88
feat(*): remove Time, Namespace, and Revision from template functions
Removes Time, Namespace, and Revision from being exposed to templates to
make template rendering discrete and repeatable.
2018-05-18 12:09:54 -07:00
Matthew Fisher
14c7be1f92
Merge pull request #3288 from bradbeam/starter
feat Making starter templates more versatile
2018-01-19 11:14:21 -08:00
Matt Farina
d5a865b5f4
fix(capabilities): Adding GitVersion to default set
Prior to this, using the semver template functions with the full
version, which is represented in the GitVersion, was not possible
for helm template and lint commands because the property was not
populated by default. This update adds default handling.

Closes #3349
2018-01-16 13:02:30 -05:00
Brad Beam
8e0eface2c Making starter templates more versatile
This adds support for changing '<CHARTNAME>'
occurances in starter chart to the destination
chart name
2018-01-01 04:34:38 +00:00
Johnny Bergström
7cc610960f Walk symbolic link directories
Continue walking symlinks to be able to use them
for sub-charts. Useful when not specifying requirements
but still want to share charts locally.
2017-11-23 11:41:09 +01:00
Johnny Bergström
d762a42168 Fix helmignore for .* (#3114)
When the first rule matching entry for top level dir
will be empty string, the .* rule will match.
Skip this entry as it's not needed for processing.
2017-11-22 09:20:41 -07:00
Kazuki Suda
fa3ee5aecf feat(helm): add --kube-version flag to helm template
This commit adds --kube-version flag to helm template. It allows you to
override the Kubernetes version used as Capabilities.KubeVersion.Major/Minor (e.g. 1.7).
2017-09-11 11:22:00 +09:00
Justin Scott
4a02a71f1e WIP feat(helm): add template command
This adds the functionality from the helm-template plugin to allow the
rendering of templates without Tiller.

Closes #2755
2017-08-28 18:04:56 -07:00
Kira
4c1a47480e feat(2450): add annotations to chart metadata (#2671)
* feat(2450): add options to chart metadata
2017-08-16 18:27:13 -04:00
Scott Rigby
6dc31f8e96 Test that the coalesced key is properly removed for all YAML null syntax options, but not for empty string 2017-07-07 14:32:56 -04:00
Sushil Kumar
82da721c0a Added tests for different combinations of subcharts & requirements.yaml
Added more tests to test following comibnations of subcharts and requirements.yaml
- [ ] subcharts not specified in requirements.yaml
- [ ] some subcharts specified in requirements.yaml while others should be picked directly from "charts\"
- [ ] all subcharts specified in requirements.yaml without alias
- [ ] subcharts specified in requirements.yaml with alias is already tested
2017-06-22 10:44:20 -07:00
Sushil Kumar
716be14ad3 Updated code to read requirements.yaml as per following structure
```
- name: <dependency-chart-name>
  alias: <alias-name-to-be-used>
  version: <dependency-chart-version>
  repository: <dependency-chart-version>
```
2017-06-05 14:35:44 -07:00
Sushil Kumar
42aa81e7ca Added tests for alias(es) for chart dependencies 2017-05-25 14:18:32 -07:00
Justin Scott
75ea566413 Correct indention of YAML field in subchartB 2017-03-31 10:46:50 -07:00
Justin Scott
3bf143f052 Fix codefences and nits in charts.md. Correct whitespace in charts. Add clarity to description of ImportValues requirements field. 2017-03-31 10:19:08 -07:00
Justin Scott
7ea4d8c7c4 Refactor so parent's values win 2017-03-31 10:19:08 -07:00
Justin Scott
007bb9dbae Implement 'exports' convetion for simple list items 2017-03-31 10:19:08 -07:00