if kdu_name and (
primitive_name in ("upgrade", "rollback", "status") or kdu_action
):
- # kdur and desc_params already set from before
- if primitive_params:
- desc_params.update(primitive_params)
# TODO Check if we will need something at vnf level
for index, kdu in enumerate(get_iterable(nsr_deployed, "K8s")):
if (
+ "Exec k8s {} on {}.{}".format(primitive_name, vnf_index, kdu_name)
)
step = "Executing kdu {}".format(primitive_name)
- if primitive_name == "upgrade":
- if desc_params.get("kdu_model"):
- kdu_model = desc_params.get("kdu_model")
- del desc_params["kdu_model"]
+ if primitive_name == "upgrade" and primitive_params:
+ if primitive_params.get("kdu_model"):
+ kdu_model = primitive_params.pop("kdu_model")
else:
kdu_model = kdu.get("kdu-model")
if kdu_model.count("/") < 2: # helm chart is not embedded
parts = kdu_model.split(sep=":")
if len(parts) == 2:
kdu_model = parts[0]
- if desc_params.get("kdu_atomic_upgrade"):
- atomic_upgrade = desc_params.get(
+ if primitive_params.get("kdu_atomic_upgrade"):
+ atomic_upgrade = primitive_params.get(
"kdu_atomic_upgrade"
).lower() in ("yes", "true", "1")
- del desc_params["kdu_atomic_upgrade"]
+ del primitive_params["kdu_atomic_upgrade"]
else:
atomic_upgrade = True
# Type of upgrade: reset, reuse, reset_then_reuse
# 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)
+ ("kdu_reset_values" not in primitive_params)
+ and ("kdu_reuse_values" not in primitive_params)
+ and ("kdu_reset_then_reuse_values" not in primitive_params)
):
reuse_values = True
else:
- if desc_params.get("kdu_reset_values"):
- reset_values = desc_params.pop(
+ if primitive_params.get("kdu_reset_values"):
+ reset_values = primitive_params.pop(
"kdu_reset_values"
).lower() in ("yes", "true", "1")
- if desc_params.get("kdu_reuse_values"):
- reuse_values = desc_params.pop(
+ if primitive_params.get("kdu_reuse_values"):
+ reuse_values = primitive_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(
+ if primitive_params.get("kdu_reset_then_reuse_values"):
+ reset_then_reuse_values = primitive_params.get(
"kdu_reset_then_reuse_values"
).lower() in ("yes", "true", "1")
# Two true options are not possible
raise LcmException(
"Cannot upgrade the KDU simultaneously with two true options to handle values"
)
-
+ # kdur and desc_params already set from before
+ if reset_values:
+ desc_params = primitive_params
+ else:
+ desc_params.update(primitive_params)
detailed_status = await asyncio.wait_for(
self.k8scluster_map[kdu["k8scluster-type"]].upgrade(
cluster_uuid=kdu.get("k8scluster-uuid"),