Added a new flag `--notes` to the `helm template`
command, with the default set to `false`.
If enabled, it will print the rendered `NOTES.txt`
at the end of the manifests.
If `--render-subchart-notes` (this flag already
exists on the `template` command, as it is
inherited from the `install` command) is also
enabled, the output will include the subcharts'
notes as well.
Updated the `install` command's
`--render-subchart-notes` flag description to
clarify that, in the case of the `template`
command, it is only valid when the `--notes` flag
is enabled.
Note: the `template` command uses most of the
`install` command's flags, including
`--render-subchart-notes`.
Updated `action.renderResources()` to format the
root chart's notes, and the subcharts' notes if
the `--render-subchart-notes` flag is enabled, and
return them as a string. The output depends on
whether it is:
- **Dry run**
- Notes are prefixed with the source filename
and separated with `---`.
- For `helm install` / `helm upgrade`, the
`--dry-run` flag enables this behavior.
- The `helm template` command is considered a
dry run by default.
- Example:
```
foo NOTES HERE
bar NOTES HERE
baz NOTES HERE
qux NOTES HERE
```
- **Not a dry run**
- Only the root chart's notes are rendered by
default.
- If the `--render-subchart-notes` flag is
enabled, the subcharts' notes are also
included.
- Each note is prefixed with the source filename
and separated with `---`.
- Example:
```
---
# Source: foo/templates/NOTES.txt
foo NOTES HERE
---
# Source: foo/charts/bar/templates/NOTES.txt
bar NOTES HERE
---
# Source: foo/charts/baz/templates/NOTES.txt
baz NOTES HERE
---
# Source: foo/charts/bar/charts/qux/templates/NOTES.txt
qux NOTES HERE
```
In both cases, the notes are sorted based on the
following conditions:
1. Depth
2. Alphabetical order (since the notes file name
is always the same, the sorting applies to the
chart/subchart name).
Added tests for the following scenarios:
- helm template:
1. On the chart without notes or subcharts
2. `--notes` on chart without notes or
subcharts
3. `--render-subchart-notes` on chart without
notes or subcharts
4. `--notes --render-subchart-notes` on chart
without notes or subcharts
5. On the chart with notes without subcharts
6. `--notes` on chart with notes without
subcharts
7. `--render-subchart-notes` on chart with
notes without subcharts
8. `--notes --render-subchart-notes` on chart
with notes without subcharts
9. On the chart with notes and subchart
10. `--notes` on chart with notes and subchart
11. `--render-subchart-notes` on the chart with
notes and subchart
12. `--notes --render-subchart-notes` on chart
with notes and subchart
13. `--help`
- helm install:
1. On the chart without notes or subcharts
2. `--dry-run` on chart without notes or
subcharts
3. `--render-subchart-notes` on chart without
notes or subcharts
4. `--dry-run --render-subchart-notes` on chart
without notes or subcharts
5. On the chart with notes without subcharts
6. `--dry-run` on chart with notes without
subcharts
7. `--render-subchart-notes` on chart with
notes without subcharts
8. `--dry-run --render-subchart-notes` on chart
with notes without subcharts
9. On a chart with notes and subcharts
10. `--dry-run` on chart with notes and
subcharts
11. `--render-subchart-notes` on chart with
notes and subcharts
12. `--dry-run --render-subchart-notes` on
chart with notes and subcharts
13. `--help`
- helm upgrade:
1. On the chart without notes or subcharts
2. `--dry-run` on chart without notes or
subcharts
3. `--render-subchart-notes` on chart without
notes or subcharts
4. `--dry-run --render-subchart-notes` on chart
without notes or subcharts
5. On the chart with notes without subcharts
6. `--dry-run` on chart with notes without
subcharts
7. `--render-subchart-notes` on chart with
notes without subcharts
8. `--dry-run --render-subchart-notes` on chart
with notes without subcharts
9. On the chart with notes and subcharts
10. `--dry-run` on chart with notes and
subcharts
11. `--render-subchart-notes` on chart with
notes and subcharts
12. `--dry-run --render-subchart-notes` on
chart with notes and subcharts
13. `--help`
Closes#6901
Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
* Runtime abstraction to encapsulate subprocess code and enable future runtimes
Also fix race condition in TestPrepareCommandExtraArgs by replacing the shared variable modification with a local copy
Co-authored-by: George Jenkins <gvjenkins@gmail.com>
Signed-off-by: Scott Rigby <scott@r6by.com>
* Remove commented out code
Co-authored-by: Joe Julian <me@joejulian.name>
Signed-off-by: Scott Rigby <scott@r6by.com>
* Check test failure string
Co-authored-by: Jesse Simpson <jesse.simpson36@gmail.com>
Signed-off-by: Scott Rigby <scott@r6by.com>
---------
Signed-off-by: Scott Rigby <scott@r6by.com>
Co-authored-by: George Jenkins <gvjenkins@gmail.com>
Co-authored-by: Joe Julian <me@joejulian.name>
Co-authored-by: Jesse Simpson <jesse.simpson36@gmail.com>
The `vaildateTemplatesDir` function would still return `nil` if the directory doesn't exist,
so the early return that was documented never occurs.
Signed-off-by: Zach Burgess <zachburg@google.com>
This reverts #13533
This change has caused issues with numerous charts around things
unrelated to toml. This is because of functions like typeIs/typeOf
being used and acted upon.
The change caused a significant regression.
Note: This kind of change can be put into v3 charts, that are in
active development, without causing a regression.
Closes#30880
Signed-off-by: Matt Farina <matt@mattfarina.com>
A new library was introduced that provides JSON Schema checking for
newer versions of the schema. In Helm v4, there is no need to have
two packages doing the JSON schema validation. The message output
can have breaking changes.
This change moves everything to the newer library. It also uses a
wrapper error to enable a clean Helm only interface for the
public Go API validation functions. This would enable the replacement
of the Schema validation library, if needed, without breaking the
Go API contract.
Signed-off-by: Matt Farina <matt.farina@suse.com>
A .gitignore was previously setup to ignore this file. When pkg/cmd
was setup the .gitignore was not updated. The change adds the new
location to continue to ignore this file.
Note, the previous location is still included in the .gitignore
because developers will have a file there and we do not want that
accidently included in a commit.
Signed-off-by: Matt Farina <matt.farina@suse.com>
So we should use dynamic handler to set the log level after. With this
patch we can clearly see the output. Before we were always stuck in log
level "info" and not seeing debug log level
```
bin/helm upgrade --install --debug --wait frontend \
--namespace test \
--set replicaCount=2 \
--set backend=http://backend-podinfo:9898/echo \
podinfo/podinfo
level=DEBUG msg="getting history for release" release=frontend
level=DEBUG msg="preparing upgrade" name=frontend
level=DEBUG msg="performing update" name=frontend
level=DEBUG msg="creating upgraded release" name=frontend
level=DEBUG msg="checking resources for changes" resources=2
level=DEBUG msg="no changes detected" kind=Service name=frontend-podinfo
level=DEBUG msg="patching resource" kind=Deployment name=frontend-podinfo namespace=test
level=DEBUG msg="waiting for resources" count=2 timeout=5m0s
level=DEBUG msg="waiting for resource" name=frontend-podinfo kind=Deployment expectedStatus=Current actualStatus=Unknown
level=DEBUG msg="updating status for upgraded release" name=frontend
Release "frontend" has been upgraded. Happy Helming!
NAME: frontend
LAST DEPLOYED: Thu Apr 10 09:56:25 2025
NAMESPACE: test
STATUS: deployed
REVISION: 6
DESCRIPTION: Upgrade complete
```
Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>