Fix cluster update workflow to read properly params and use unique workflow_name 03/14703/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 6 Nov 2024 09:45:22 +0000 (10:45 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 6 Nov 2024 11:56:53 +0000 (12:56 +0100)
Change-Id: I848f29db66fc4a5795cda80fa6c56ac8d0209807
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_lcm/odu_libs/cluster_mgmt.py

index a3c821b..4ef8a49 100644 (file)
@@ -135,11 +135,11 @@ async def update_cluster(self, op_id, op_params, content):
 
     db_cluster = content["cluster"]
     db_vim_account = content["vim_account"]
+    cluster_name = db_cluster["git_name"].lower()
 
     workflow_template = "launcher-update-crossplane-cluster.j2"
-    workflow_name = f"update-cluster-{db_cluster['_id']}"
+    workflow_name = f"update-cluster-{cluster_name}-{op_id}"
     # cluster_name = db_cluster["name"].lower()
-    cluster_name = db_cluster["git_name"].lower()
 
     # Get age key
     public_key_cluster, private_key_cluster = gather_age_key(db_cluster)
@@ -164,6 +164,9 @@ async def update_cluster(self, op_id, op_params, content):
     vim_account_id = db_cluster["vim_account"]
     providerconfig_name = f"{vim_account_id}-config"
     vim_type = db_vim_account["vim_type"]
+    vm_size = op_params.get("node_size", db_cluster["node_size"])
+    node_count = op_params.get("node_count", db_cluster["node_count"])
+    k8s_version = op_params.get("k8s_version", db_cluster["k8s_version"])
     if vim_type == "azure":
         cluster_type = "aks"
     elif vim_type == "aws":
@@ -187,9 +190,9 @@ async def update_cluster(self, op_id, op_params, content):
         public_key_mgmt=self._pubkey,
         public_key_new_cluster=public_key_cluster,
         secret_name_private_key_new_cluster=secret_name,
-        vm_size=db_cluster["node_size"],
-        node_count=db_cluster["node_count"],
-        k8s_version=db_cluster["k8s_version"],
+        vm_size=vm_size,
+        node_count=node_count,
+        k8s_version=k8s_version,
         cluster_location=db_cluster["region_name"],
         osm_project_name=osm_project_name,
         workflow_debug=self._workflow_debug,