From: garciadeblas Date: Fri, 30 May 2025 09:19:06 +0000 (+0200) Subject: Fix condition to check for AWS cluster scale, rename nodepool to nodegroup X-Git-Tag: v18.0.0~13 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F15210%2F2;p=osm%2FLCM.git Fix condition to check for AWS cluster scale, rename nodepool to nodegroup Change-Id: I9618fa83a009c803b55565c6f6cc675537875f87 Signed-off-by: garciadeblas --- diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py index 83f57e40..3a2d8b7e 100644 --- a/osm_lcm/k8s.py +++ b/osm_lcm/k8s.py @@ -517,12 +517,12 @@ class ClusterLcm(GitOpsLcm): cluster_kustomization_name = cluster_name db_vim_account = content["vim_account"] cloud_type = db_vim_account["vim_type"] - nodepool_name = "" + nodegroup_name = "" if cloud_type == "aws": - nodepool_name = f"{cluster_name}-nodegroup" + nodegroup_name = f"{cluster_name}-nodegroup" cluster_name = f"{cluster_name}-cluster" elif cloud_type == "gcp": - nodepool_name = f"nodepool-{cluster_name}" + nodegroup_name = f"nodepool-{cluster_name}" bootstrap = op_params.get("bootstrap", True) if cloud_type in ("azure", "gcp", "aws"): checkings_list = [ @@ -577,10 +577,10 @@ class ClusterLcm(GitOpsLcm): ] else: return False, "Not suitable VIM account to check cluster status" - if nodepool_name: - nodepool_check = { - "item": f"nodepool_{cloud_type}", - "name": nodepool_name, + if nodegroup_name: + nodegroup_check = { + "item": f"nodegroup_{cloud_type}", + "name": nodegroup_name, "namespace": "", "condition": { "jsonpath_filter": "status.conditions[?(@.type=='Ready')].status", @@ -588,9 +588,9 @@ class ClusterLcm(GitOpsLcm): }, "timeout": self._checkloop_resource_timeout, "enable": True, - "resourceState": "IN_PROGRESS.RESOURCE_READY.NODEPOOL", + "resourceState": "IN_PROGRESS.RESOURCE_READY.NODEGROUP", } - checkings_list.insert(3, nodepool_check) + checkings_list.insert(3, nodegroup_check) return await self.common_check_list( op_id, checkings_list, "clusters", db_cluster ) @@ -1384,20 +1384,37 @@ class ClusterLcm(GitOpsLcm): return False, "Not suitable VIM account to check cluster status" # Scale operation if "node_count" in op_params: - checkings_list.append( - { - "item": f"cluster_{cloud_type}", - "name": cluster_name, - "namespace": "", - "condition": { - "jsonpath_filter": "status.atProvider.defaultNodePool[0].nodeCount", - "value": f"{op_params['node_count']}", - }, - "timeout": self._checkloop_resource_timeout * 3, - "enable": True, - "resourceState": "IN_PROGRESS.RESOURCE_READY.NODE_COUNT.CLUSTER", - } - ) + if cloud_type in ("azure", "gcp"): + checkings_list.append( + { + "item": f"cluster_{cloud_type}", + "name": cluster_name, + "namespace": "", + "condition": { + "jsonpath_filter": "status.atProvider.defaultNodePool[0].nodeCount", + "value": f"{op_params['node_count']}", + }, + "timeout": self._checkloop_resource_timeout * 3, + "enable": True, + "resourceState": "IN_PROGRESS.RESOURCE_READY.NODE_COUNT.CLUSTER", + } + ) + elif cloud_type == "aws": + checkings_list.append( + { + "item": f"nodegroup_{cloud_type}", + "name": f"{cluster_name}-nodegroup", + "namespace": "", + "condition": { + "jsonpath_filter": "status.atProvider.scalingConfig[0].desiredSize", + "value": f"{op_params['node_count']}", + }, + "timeout": self._checkloop_resource_timeout * 3, + "enable": True, + "resourceState": "IN_PROGRESS.RESOURCE_READY.NODE_COUNT.CLUSTER", + } + ) + # Upgrade operation if "k8s_version" in op_params: checkings_list.append( diff --git a/osm_lcm/odu_libs/workflows.py b/osm_lcm/odu_libs/workflows.py index 55163e71..92c4602f 100644 --- a/osm_lcm/odu_libs/workflows.py +++ b/osm_lcm/odu_libs/workflows.py @@ -94,12 +94,12 @@ async def readiness_loop( "api_plural": "clusters", "api_version": "v1beta2", }, - "nodepool_aws": { + "nodegroup_aws": { "api_group": "eks.aws.upbound.io", "api_plural": "nodegroups", "api_version": "v1beta1", }, - "nodepool_gcp": { + "nodegroup_gcp": { "api_group": "container.gcp.upbound.io", "api_plural": "nodepools", "api_version": "v1beta2",