Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validate argument to helm_template #587

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
pauvos marked this conversation as resolved.
Show resolved Hide resolved
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