From: garciadeblas Date: Thu, 8 Feb 2024 13:11:51 +0000 (+0100) Subject: Feature 11014: enable option kdu_reset_values to reset values for upgrade operation... X-Git-Tag: release-v16.0-start~8 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F24%2F14224%2F6;p=osm%2FLCM.git Feature 11014: enable option kdu_reset_values to reset values for upgrade operation on helm charts Change-Id: I2d5e8e1436b5be3fcf9d7fd965338df51feb009a Signed-off-by: garciadeblas --- diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index ea57400..6bc7a22 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -5244,12 +5244,48 @@ class NsLcm(LcmBase): del desc_params["kdu_atomic_upgrade"] else: atomic_upgrade = True + # Type of upgrade: reset, reuse, reset_then_reuse + reset_values = False + reuse_values = False + reset_then_reuse_values = False + # If no option is specified, default behaviour is reuse_values + # Otherwise, options will be parsed and used + if ( + ("kdu_reset_values" not in desc_params) + and ("kdu_reuse_values" not in desc_params) + and ("kdu_reset_then_reuse_values" not in desc_params) + ): + reuse_values = True + else: + if desc_params.get("kdu_reset_values"): + reset_values = desc_params.pop( + "kdu_reset_values" + ).lower() in ("yes", "true", "1") + if desc_params.get("kdu_reuse_values"): + reuse_values = desc_params.pop( + "kdu_reuse_values" + ).lower() in ("yes", "true", "1") + if desc_params.get("kdu_reset_then_reuse_values"): + reset_then_reuse_values = desc_params.get( + "kdu_reset_then_reuse_values" + ).lower() in ("yes", "true", "1") + # Two true options are not possible + if ( + sum([reset_values, reuse_values, reset_then_reuse_values]) + >= 2 + ): + raise LcmException( + "Cannot upgrade the KDU simultaneously with two true options to handle values" + ) detailed_status = await asyncio.wait_for( self.k8scluster_map[kdu["k8scluster-type"]].upgrade( cluster_uuid=kdu.get("k8scluster-uuid"), kdu_instance=kdu.get("kdu-instance"), atomic=atomic_upgrade, + reset_values=reset_values, + reuse_values=reuse_values, + reset_then_reuse_values=reset_then_reuse_values, kdu_model=kdu_model, params=desc_params, db_dict=db_dict,