mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-07-29 10:54:41 +00:00
helm - allow setting timeout independent of wait parameter (#231)
helm - allow setting timeout independent of wait parameter SUMMARY closes #67 ISSUE TYPE Feature Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Abhijeet Kasurde <None> Reviewed-by: None <None>
This commit is contained in:
2
changelogs/fragments/231-helm-add-timeout-parameter.yaml
Normal file
2
changelogs/fragments/231-helm-add-timeout-parameter.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- helm - add support for timeout cli parameter to allow setting Helm timeout independent of wait (https://github.com/ansible-collections/kubernetes.core/issues/67).
|
||||||
@@ -114,7 +114,15 @@ options:
|
|||||||
wait_timeout:
|
wait_timeout:
|
||||||
description:
|
description:
|
||||||
- Timeout when wait option is enabled (helm2 is a number of seconds, helm3 is a duration).
|
- Timeout when wait option is enabled (helm2 is a number of seconds, helm3 is a duration).
|
||||||
|
- The use of I(wait_timeout) to wait for kubernetes commands to complete has been deprecated and will be removed after 2022-12-01.
|
||||||
type: str
|
type: str
|
||||||
|
timeout:
|
||||||
|
description:
|
||||||
|
- A Go duration (described here I(https://pkg.go.dev/time#ParseDuration)) value to wait for Kubernetes commands to complete. This defaults to 5m0s.
|
||||||
|
- similar to C(wait_timeout) but does not required C(wait) to be activated.
|
||||||
|
- Mutually exclusive with C(wait_timeout).
|
||||||
|
type: str
|
||||||
|
version_added: "2.3.0"
|
||||||
atomic:
|
atomic:
|
||||||
description:
|
description:
|
||||||
- If set, the installation process deletes the installation on failure.
|
- If set, the installation process deletes the installation on failure.
|
||||||
@@ -365,7 +373,7 @@ def fetch_chart_info(module, command, chart_ref):
|
|||||||
|
|
||||||
def deploy(command, release_name, release_values, chart_name, wait,
|
def deploy(command, release_name, release_values, chart_name, wait,
|
||||||
wait_timeout, disable_hook, force, values_files, history_max, atomic=False,
|
wait_timeout, disable_hook, force, values_files, history_max, atomic=False,
|
||||||
create_namespace=False, replace=False, skip_crds=False):
|
create_namespace=False, replace=False, skip_crds=False, timeout=None):
|
||||||
"""
|
"""
|
||||||
Install/upgrade/rollback release chart
|
Install/upgrade/rollback release chart
|
||||||
"""
|
"""
|
||||||
@@ -386,6 +394,9 @@ def deploy(command, release_name, release_values, chart_name, wait,
|
|||||||
if atomic:
|
if atomic:
|
||||||
deploy_command += " --atomic"
|
deploy_command += " --atomic"
|
||||||
|
|
||||||
|
if timeout:
|
||||||
|
deploy_command += " --timeout " + timeout
|
||||||
|
|
||||||
if force:
|
if force:
|
||||||
deploy_command += " --force"
|
deploy_command += " --force"
|
||||||
|
|
||||||
@@ -537,6 +548,7 @@ def main():
|
|||||||
purge=dict(type='bool', default=True),
|
purge=dict(type='bool', default=True),
|
||||||
wait=dict(type='bool', default=False),
|
wait=dict(type='bool', default=False),
|
||||||
wait_timeout=dict(type='str'),
|
wait_timeout=dict(type='str'),
|
||||||
|
timeout=dict(type='str'),
|
||||||
atomic=dict(type='bool', default=False),
|
atomic=dict(type='bool', default=False),
|
||||||
create_namespace=dict(type='bool', default=False),
|
create_namespace=dict(type='bool', default=False),
|
||||||
replace=dict(type='bool', default=False),
|
replace=dict(type='bool', default=False),
|
||||||
@@ -557,6 +569,7 @@ def main():
|
|||||||
("context", "ca_cert"),
|
("context", "ca_cert"),
|
||||||
("kubeconfig", "ca_cert"),
|
("kubeconfig", "ca_cert"),
|
||||||
("replace", "history_max"),
|
("replace", "history_max"),
|
||||||
|
("wait_timeout", "timeout"),
|
||||||
],
|
],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
@@ -587,6 +600,7 @@ def main():
|
|||||||
replace = module.params.get('replace')
|
replace = module.params.get('replace')
|
||||||
skip_crds = module.params.get('skip_crds')
|
skip_crds = module.params.get('skip_crds')
|
||||||
history_max = module.params.get('history_max')
|
history_max = module.params.get('history_max')
|
||||||
|
timeout = module.params.get('timeout')
|
||||||
|
|
||||||
if bin_path is not None:
|
if bin_path is not None:
|
||||||
helm_cmd_common = bin_path
|
helm_cmd_common = bin_path
|
||||||
@@ -622,7 +636,7 @@ def main():
|
|||||||
helm_cmd = deploy(helm_cmd, release_name, release_values, chart_ref, wait, wait_timeout,
|
helm_cmd = deploy(helm_cmd, release_name, release_values, chart_ref, wait, wait_timeout,
|
||||||
disable_hook, False, values_files=values_files, atomic=atomic,
|
disable_hook, False, values_files=values_files, atomic=atomic,
|
||||||
create_namespace=create_namespace, replace=replace,
|
create_namespace=create_namespace, replace=replace,
|
||||||
skip_crds=skip_crds, history_max=history_max)
|
skip_crds=skip_crds, history_max=history_max, timeout=timeout)
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -639,7 +653,7 @@ def main():
|
|||||||
helm_cmd = deploy(helm_cmd, release_name, release_values, chart_ref, wait, wait_timeout,
|
helm_cmd = deploy(helm_cmd, release_name, release_values, chart_ref, wait, wait_timeout,
|
||||||
disable_hook, force, values_files=values_files, atomic=atomic,
|
disable_hook, force, values_files=values_files, atomic=atomic,
|
||||||
create_namespace=create_namespace, replace=replace,
|
create_namespace=create_namespace, replace=replace,
|
||||||
skip_crds=skip_crds, history_max=history_max)
|
skip_crds=skip_crds, history_max=history_max, timeout=timeout)
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
|
|||||||
Reference in New Issue
Block a user