X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Fk8s_helm_conn.py;fp=n2vc%2Fk8s_helm_conn.py;h=0ea89203e10ae7a01624bf1da9abe6ddcf41acac;hp=cd440a965730dc0a16f50872af2e764ff6bd4194;hb=085fa8d4658a9b621354d5a08853086e2696abdc;hpb=2e69dc6c54da708a5ea45763eca0cf65785fb7dc diff --git a/n2vc/k8s_helm_conn.py b/n2vc/k8s_helm_conn.py index cd440a9..0ea8920 100644 --- a/n2vc/k8s_helm_conn.py +++ b/n2vc/k8s_helm_conn.py @@ -702,6 +702,7 @@ class K8sHelmConnector(K8sHelmBaseConnector): atomic, timeout, kubeconfig, + force: bool = False, ) -> str: """Generates the command to upgrade a Helm Chart release @@ -715,7 +716,7 @@ class K8sHelmConnector(K8sHelmBaseConnector): 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 """ @@ -729,18 +730,30 @@ class K8sHelmConnector(K8sHelmBaseConnector): 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,