Skip to content

Commit

Permalink
Add validate argument to helm_template
Browse files Browse the repository at this point in the history
  • Loading branch information
pauvos committed Feb 20, 2023
1 parent 31c1ccf commit aaeeb1d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/587-helm_template-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- helm_template - add validate support to helm_template module (https://github.com/ansible-collections/kubernetes.core/pull/587).
14 changes: 14 additions & 0 deletions plugins/modules/helm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@
type: list
elements: str
version_added: 2.4.0
validate:
description:
- Validate your manifests against the Kubernetes cluster you are currently pointing at. This is the same validation performed on an install.
required: false
type: bool
default: false
version_added: 2.5.0
values_files:
description:
- Value files to pass to chart.
Expand Down Expand Up @@ -226,6 +233,7 @@ def template(
release_values=None,
values_files=None,
include_crds=False,
validate=False,
set_values=None,
):
cmd += " template "
Expand Down Expand Up @@ -270,6 +278,9 @@ def template(
if include_crds:
cmd += " --include-crds"

if validate:
cmd += " --validate"

if set_values:
cmd += " " + set_values

Expand All @@ -291,6 +302,7 @@ def main():
release_namespace=dict(type="str"),
release_values=dict(type="dict", default={}, aliases=["values"]),
show_only=dict(type="list", default=[], elements="str"),
validate=dict(type="bool", default=False),
values_files=dict(type="list", default=[], elements="str"),
update_repo_cache=dict(type="bool", default=False),
set_values=dict(type="list", elements="dict"),
Expand All @@ -310,6 +322,7 @@ def main():
show_only = module.params.get("show_only")
release_namespace = module.params.get("release_namespace")
release_values = module.params.get("release_values")
validate = module.params.get("validate")
values_files = module.params.get("values_files")
update_repo_cache = module.params.get("update_repo_cache")
set_values = module.params.get("set_values")
Expand Down Expand Up @@ -341,6 +354,7 @@ def main():
show_only=show_only,
values_files=values_files,
include_crds=include_crds,
validate=validate,
set_values=set_values_args,
)

Expand Down

0 comments on commit aaeeb1d

Please sign in to comment.