Feature 10956: Add namespace and force arguments to helm upgrade
Change-Id: I8e37e43b72c5f7f63c4b9f49542905727610fa5a
Signed-off-by: Gabriel Cuba <gcuba@whitestack.com>
diff --git a/n2vc/k8s_helm3_conn.py b/n2vc/k8s_helm3_conn.py
index d828da2..3d7e3b2 100644
--- a/n2vc/k8s_helm3_conn.py
+++ b/n2vc/k8s_helm3_conn.py
@@ -544,6 +544,7 @@
atomic: bool,
timeout: float,
kubeconfig: str,
+ force: bool = False,
) -> str:
"""Generates the command to upgrade a Helm Chart release
@@ -557,7 +558,7 @@
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
"""
@@ -571,6 +572,11 @@
if atomic:
atomic_str = "--atomic"
+ # force
+ force_str = ""
+ if force:
+ force_str = "--force "
+
# version
version_str = ""
if version:
@@ -582,7 +588,7 @@
namespace_str = "--namespace {}".format(namespace)
command = (
- "env KUBECONFIG={kubeconfig} {helm} upgrade {name} {model} {namespace} {atomic} "
+ "env KUBECONFIG={kubeconfig} {helm} upgrade {name} {model} {namespace} {atomic} {force}"
"--output yaml {params} {timeout} --reuse-values {ver}"
).format(
kubeconfig=kubeconfig,
@@ -590,6 +596,7 @@
name=kdu_instance,
namespace=namespace_str,
atomic=atomic_str,
+ force=force_str,
params=params_str,
timeout=timeout_str,
model=kdu_model,