atomic,
timeout,
kubeconfig,
+ force: bool = False,
) -> str:
"""Generates the command to upgrade a Helm Chart release
The --wait flag will be set automatically if --atomic is used
timeout (float): The time, in seconds, to wait
kubeconfig (str): Kubeconfig file path
-
+ force (bool): If set, helm forces resource updates through a replacement strategy. This may recreate pods.
Returns:
str: command to upgrade a Helm Chart release
"""
if atomic:
atomic_str = "--atomic"
+ # force
+ force_str = ""
+ if force:
+ force_str = "--force "
+
# version
version_str = ""
if version:
version_str = "--version {}".format(version)
+ # namespace
+ namespace_str = ""
+ if namespace:
+ namespace_str = "--namespace {}".format(namespace)
+
command = (
- "env KUBECONFIG={kubeconfig} {helm} upgrade {atomic} --output yaml {params} {timeout} "
+ "env KUBECONFIG={kubeconfig} {helm} upgrade {namespace} {atomic} --output yaml {params} {timeout} {force}"
"--reuse-values {name} {model} {ver}"
).format(
kubeconfig=kubeconfig,
helm=self._helm_command,
+ namespace=namespace_str,
atomic=atomic_str,
+ force=force_str,
params=params_str,
timeout=timeout_str,
name=kdu_instance,