timeout: float = 300,
params: dict = None,
db_dict: dict = None,
+ reset_values: bool = False,
+ reuse_values: bool = True,
+ reset_then_reuse_values: bool = False,
force: bool = False,
):
"""
path: <str>},
e.g. {collection: "nsrs", filter:
{_id: <nsd-id>, path: "_admin.deployed.K8S.3"}
+ :param reset_values: force reseting values
+ :param reuse_values: force reusing values (default)
+ :param reset_then_reuse_values: forces reseting values, then apply the last release's values
:param force: force recreation of resources if necessary
:return: reference to the new revision number of the KDU instance
"""
atomic: bool,
timeout: float,
kubeconfig: str,
+ reset_values: bool = False,
+ reuse_values: bool = True,
+ reset_then_reuse_values: bool = False,
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
+ reset_values(bool): If set, helm resets values instead of reusing previous values.
+ reuse_values(bool): If set, helm reuses previous values.
+ reset_then_reuse_values(bool): If set, helm resets values, then apply the last release's values
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 namespace:
namespace_str = "--namespace {}".format(quote(namespace))
+ # reset, reuse or reset_then_reuse values
+ on_values_str = "--reuse-values"
+ if reset_values:
+ on_values_str = "--reset-values"
+ elif reuse_values:
+ on_values_str = "--reuse-values"
+ elif reset_then_reuse_values:
+ on_values_str = "--reset-then-reuse-values"
command = (
"env KUBECONFIG={kubeconfig} {helm} upgrade {name} {model} {namespace} {atomic} {force}"
- "--output yaml {params} {timeout} --reuse-values {ver}"
+ "--output yaml {params} {timeout} {on_values} {ver}"
).format(
kubeconfig=kubeconfig,
helm=self._helm_command,
params=params_str,
timeout=timeout_str,
model=quote(kdu_model),
+ on_values=on_values_str,
ver=version_str,
)
return command
params: dict = None,
db_dict: dict = None,
namespace: str = None,
+ reset_values: bool = False,
+ reuse_values: bool = True,
+ reset_then_reuse_values: bool = False,
force: bool = False,
):
self.log.debug("upgrading {} in cluster {}".format(kdu_model, cluster_uuid))
atomic,
timeout,
paths["kube_config"],
+ reset_values,
+ reuse_values,
+ reset_then_reuse_values,
force,
)
atomic,
timeout,
kubeconfig,
+ reset_values,
+ reuse_values,
+ reset_then_reuse_values,
force,
) -> 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
+ reset_values(bool): If set, helm resets values instead of reusing previous values.
+ reuse_values(bool): If set, helm reuses previous values.
+ reset_then_reuse_values(bool): If set, helm resets values, then apply the last release's values
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