From c41fe83a651559f7e85e959beaeff5ea0a1ceaaa Mon Sep 17 00:00:00 2001 From: aktas Date: Mon, 29 Nov 2021 18:41:42 +0300 Subject: [PATCH] Feature 10886 manual scaling for KNF (helm chart) deployment Change-Id: Icacddc7681f1b5be73e09f186c1aed19fbfabcab Signed-off-by: aktas --- osm_lcm/ns.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 22a3dcc..4192625 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -5333,7 +5333,7 @@ class NsLcm(LcmBase): for kdu_delta in delta.get("kdu-resource-delta", {}): kdu_profile = get_kdu_resource_profile(db_vnfd, kdu_delta["id"]) kdu_name = kdu_profile["kdu-name"] - resource_name = kdu_profile["resource-name"] + resource_name = kdu_profile.get("resource-name", "") # Might have different kdus in the same delta # Should have list for each kdu @@ -5349,7 +5349,6 @@ class NsLcm(LcmBase): and kdur.get("helm-version") == "v2" ): k8s_cluster_type = "helm-chart" - raise NotImplementedError elif kdur.get("juju-bundle"): k8s_cluster_type = "juju-bundle" else: @@ -5379,7 +5378,13 @@ class NsLcm(LcmBase): kdu_instance = deployed_kdu.get("kdu-instance") instance_num = await self.k8scluster_map[ k8s_cluster_type - ].get_scale_count(resource_name, kdu_instance, vca_id=vca_id) + ].get_scale_count( + resource_name, + kdu_instance, + vca_id=vca_id, + cluster_uuid=deployed_kdu.get("k8scluster-uuid"), + kdu_model=deployed_kdu.get("kdu-model"), + ) kdu_replica_count = instance_num + kdu_delta.get( "number-of-instances", 1 ) @@ -5463,7 +5468,7 @@ class NsLcm(LcmBase): for kdu_delta in delta.get("kdu-resource-delta", {}): kdu_profile = get_kdu_resource_profile(db_vnfd, kdu_delta["id"]) kdu_name = kdu_profile["kdu-name"] - resource_name = kdu_profile["resource-name"] + resource_name = kdu_profile.get("resource-name", "") if not scaling_info["kdu-delete"].get(kdu_name, None): scaling_info["kdu-delete"][kdu_name] = [] @@ -5477,7 +5482,6 @@ class NsLcm(LcmBase): and kdur.get("helm-version") == "v2" ): k8s_cluster_type = "helm-chart" - raise NotImplementedError elif kdur.get("juju-bundle"): k8s_cluster_type = "juju-bundle" else: @@ -5505,7 +5509,13 @@ class NsLcm(LcmBase): kdu_instance = deployed_kdu.get("kdu-instance") instance_num = await self.k8scluster_map[ k8s_cluster_type - ].get_scale_count(resource_name, kdu_instance, vca_id=vca_id) + ].get_scale_count( + resource_name, + kdu_instance, + vca_id=vca_id, + cluster_uuid=deployed_kdu.get("k8scluster-uuid"), + kdu_model=deployed_kdu.get("kdu-model"), + ) kdu_replica_count = instance_num - kdu_delta.get( "number-of-instances", 1 ) @@ -6211,6 +6221,7 @@ class NsLcm(LcmBase): ) cluster_uuid = deployed_kdu["k8scluster-uuid"] kdu_instance = deployed_kdu["kdu-instance"] + kdu_model = deployed_kdu.get("kdu-model") scale = int(kdu_scaling_info["scale"]) k8s_cluster_type = kdu_scaling_info["k8s-cluster-type"] @@ -6265,6 +6276,10 @@ class NsLcm(LcmBase): scale, kdu_scaling_info["resource-name"], vca_id=vca_id, + cluster_uuid=cluster_uuid, + kdu_model=kdu_model, + atomic=True, + db_dict=db_dict, ), timeout=self.timeout_vca_on_error, ) -- 2.17.1