Skip to content

Commit aaeeb1d

Browse files
committed
Add validate argument to helm_template
1 parent 31c1ccf commit aaeeb1d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
minor_changes:
3+
- helm_template - add validate support to helm_template module (https://github.com/ansible-collections/kubernetes.core/pull/587).

plugins/modules/helm_template.py

+14
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@
9999
type: list
100100
elements: str
101101
version_added: 2.4.0
102+
validate:
103+
description:
104+
- Validate your manifests against the Kubernetes cluster you are currently pointing at. This is the same validation performed on an install.
105+
required: false
106+
type: bool
107+
default: false
108+
version_added: 2.5.0
102109
values_files:
103110
description:
104111
- Value files to pass to chart.
@@ -226,6 +233,7 @@ def template(
226233
release_values=None,
227234
values_files=None,
228235
include_crds=False,
236+
validate=False,
229237
set_values=None,
230238
):
231239
cmd += " template "
@@ -270,6 +278,9 @@ def template(
270278
if include_crds:
271279
cmd += " --include-crds"
272280

281+
if validate:
282+
cmd += " --validate"
283+
273284
if set_values:
274285
cmd += " " + set_values
275286

@@ -291,6 +302,7 @@ def main():
291302
release_namespace=dict(type="str"),
292303
release_values=dict(type="dict", default={}, aliases=["values"]),
293304
show_only=dict(type="list", default=[], elements="str"),
305+
validate=dict(type="bool", default=False),
294306
values_files=dict(type="list", default=[], elements="str"),
295307
update_repo_cache=dict(type="bool", default=False),
296308
set_values=dict(type="list", elements="dict"),
@@ -310,6 +322,7 @@ def main():
310322
show_only = module.params.get("show_only")
311323
release_namespace = module.params.get("release_namespace")
312324
release_values = module.params.get("release_values")
325+
validate = module.params.get("validate")
313326
values_files = module.params.get("values_files")
314327
update_repo_cache = module.params.get("update_repo_cache")
315328
set_values = module.params.get("set_values")
@@ -341,6 +354,7 @@ def main():
341354
show_only=show_only,
342355
values_files=values_files,
343356
include_crds=include_crds,
357+
validate=validate,
344358
set_values=set_values_args,
345359
)
346360

0 commit comments

Comments
 (0)