X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fns.py;h=c9bcc9da315dcd4d44539f87e5a81465b6be7736;hb=refs%2Fchanges%2F24%2F8624%2F6;hp=9bc0dba0ca34eb37847348dffa6de781396982f0;hpb=0ec0c272c9053cacf0e096aac51adcb976177eaa;p=osm%2FLCM.git diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 9bc0dba..c9bcc9d 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -2076,9 +2076,28 @@ class NsLcm(LcmBase): except Exception: # it is not a file pass + + step = "Prepare instantiate KDU {} in k8s cluster {}".format( + kdur["kdu-name"], kdur["k8s-cluster"]["id"]) + try: if not error_text: cluster_uuid = _get_cluster_id(kdur["k8s-cluster"]["id"], k8sclustertype_full) + + updated_cluster_list = [] + if k8sclustertype == "chart" and cluster_uuid not in updated_cluster_list: + del_repo_list, added_repo_dict = await asyncio.ensure_future( + self.k8sclusterhelm.synchronize_repos(cluster_uuid=cluster_uuid)) + if del_repo_list or added_repo_dict: + unset = {'_admin.helm_charts_added.' + item: None for item in del_repo_list} + updated = {'_admin.helm_charts_added.' + + item: name for item, name in added_repo_dict.items()} + self.logger.debug("repos synchronized, to_delete: {}, to_add: {}". + format(del_repo_list, added_repo_dict)) + self.db.set_one("k8sclusters", {"_id": kdur["k8s-cluster"]["id"]}, + updated, unset=unset) + updated_cluster_list.append(cluster_uuid) + except LcmException as e: error_text = str(e) deployed_ok = False @@ -2097,6 +2116,7 @@ class NsLcm(LcmBase): db_dict = {"collection": "nsrs", "filter": {"_id": nsr_id}, "path": "_admin.deployed.K8s." "{}".format(index)} + if k8sclustertype == "chart": task = asyncio.ensure_future( self.k8sclusterhelm.install(cluster_uuid=cluster_uuid, kdu_model=kdumodel, atomic=True,