Introduced new CLI flag `-d`/`--values-directory`
for loading values from YAML files from a
specified directory. Following are the key
details:
- This will be used by the following commands:
1. `install`
2. `lint`
3. `package`
4. `template`
5. `upgrade`
Updated the help text of these commands with the
same.
- Made this flag the lowest in precedence i.e.,
values from values directory can be overridden
by inputs from any other input flags
(`-f`/`--values`, `--set-json`, `--set`,
`--set-string`, `--set-file`, `--set-literal`).
Note: The default values from the chart's
`values.yaml` file will have the lowest
precedence than all the input flags including
`-d`/`--values-directory` by design. In order
the values from `values.yaml` to override the
values from `-d`/`--values-directory`, users can
explicitly provide the chart's `values.yaml`
file path using the `-f`/`--values` flag.
- This flag reads all `.yaml` files from the
specified directory and its subdirectories
recursively, in lexicographical order. For eg.
for the following directory structure:
foo/
├── bar/
│ └── bar.yaml
├── baz/
│ ├── baz.yaml
│ └── qux.yaml
├── baz.txt
└── foo.yaml
The files will be read in the order:
`bar/bar.yaml`, `baz/baz.yaml`, `baz/qux.yaml`,
`foo.yaml`.
- If the specified directory does not exist, an
error is returned.
- Non-YAML files in the directory are ignored.
i.e., if the specified directory exists but
contains no YAML files, an empty map is returned
without errors.
- If multiple YAML files contain overlapping keys,
the values are overridden in lexicographical
order. For eg. in the above example, if both
`baz/baz.yaml` and `foo.yaml` contain a key
`replicaCount`, the value from `foo.yaml` will
take precedence as it is read last.
Fixes helm#10416
Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
Linting is specific to the chart versions. A v2 and v3 chart will
lint differently.
To accomplish this, packages like engine need to be able to handle
different chart versions. This was accomplished by some changes:
1. The introduction of a Charter interface for charts
2. The ChartAccessor which is able to accept a chart and then
provide access to its data via an interface. There is an
interface, factory, and implementation for each version of
chart.
3. Common packages were moved to a common and util packages.
Due to some package loops, there are 2 packages which may
get some consolidation in the future.
The new interfaces provide the foundation to move the actions
and cmd packages to be able to handle multiple apiVersions of
charts.
Signed-off-by: Matt Farina <matt.farina@suse.com>
This change moves the code, updates the import locations, and
adds a doc.go file to document what the v2 package is for.
This is part of HIP 20 for v3 charts
Signed-off-by: Matt Farina <matt.farina@suse.com>
- Add support for parsing full JSON objects with `--set-json`
- Update documentation to clarify JSON value input formats
- Improve test coverage for value parsing scenarios
- Modify `MergeValues` to handle both key=value and JSON object formats
Signed-off-by: Zhanwei Li <zhanweelee@gmail.com>
Since Helm is going through breaking changes with Helm v4, the version path to
Helm needs to be updated.
Signed-off-by: Matt Farina <matt.farina@suse.com>
At this time both Go 1.19 and 1.20 are supported. The version
specified in the go.mod file is the minimum version we expect Helm
to be compiled against. This is the oldest supported version to
support environments where others compile Helm. The Helm project
is using Go 1.20 to build Helm itself.
Updating to Go 1.19 also includes dealing with io/ioutil
deprecation and some additional linting issues around staticcheck.
All the staticcheck issues were in test files so linting was
skipped for those.
Signed-off-by: Matt Farina <matt.farina@suse.com>
The current family of '--set' methods interprets some special characters
in values (e.g. commas, square brackets, points, backslashes). With the
typical shell escaping rules, this can increase the difficulty of overwriting
values in some cases.
In contrast to '--set-string' or similar methods, '--set-literal' does
not interpret those special characters. It interprets given values as
literal strings.
Example:
--set-literal outer.inner='so\me,values'
outer:
inner: so\me,values
Closes#4030
Signed-off-by: Patrick Scheid <p.scheid92@gmail.com>
When used with helm install, helm template, helm upgrade, it enables
to set json values (scalars/objects/arrays) from the command line.
Closes#10428
Signed-off-by: Luca Di Rocco <lucadirocco@gmail.com>
I made a few modifications from the original code to fit in with the new
code layout and to clarify a few things. This is a port of #3758
Signed-off-by: Taylor Thomas <taylor.thomas@microsoft.com>
* allow repository config via cli
* make `helm repo add` create repo config file if it does not exist
* squash a ton of bugs
Signed-off-by: Adam Reese <adam@reese.io>