self.log.debug("install helm chart: {}".format(full_path))
if vca_type == "helm":
- helm_id = await self._k8sclusterhelm2.install(system_cluster_uuid, kdu_model=full_path,
- namespace=self._KUBECTL_OSM_NAMESPACE,
- params=config,
- db_dict=db_dict,
- timeout=progress_timeout)
+ helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
+ db_dict=db_dict,
+ kdu_model=full_path,
+ )
+ await self._k8sclusterhelm2.install(system_cluster_uuid, kdu_model=full_path,
+ kdu_instance=helm_id,
+ namespace=self._KUBECTL_OSM_NAMESPACE,
+ params=config,
+ db_dict=db_dict,
+ timeout=progress_timeout)
else:
- helm_id = await self._k8sclusterhelm3.install(system_cluster_uuid, kdu_model=full_path,
- namespace=self._KUBECTL_OSM_NAMESPACE,
- params=config,
- db_dict=db_dict,
- timeout=progress_timeout)
+ helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
+ db_dict=db_dict,
+ kdu_model=full_path,
+ )
+ await self._k8sclusterhelm3.install(system_cluster_uuid, kdu_model=full_path,
+ kdu_instance=helm_id,
+ namespace=self._KUBECTL_OSM_NAMESPACE,
+ params=config,
+ db_dict=db_dict,
+ timeout=progress_timeout)
ee_id = "{}:{}.{}".format(vca_type, self._KUBECTL_OSM_NAMESPACE, helm_id)
return ee_id, None
cloud_name=vca_k8s_cloud,
credential_name=vca_k8s_cloud_credential,
)
- elif vca_type == "helm" or vca_type == "helm-v3":
+ elif vca_type == "helm" or vca_type == "helm-v3":
ee_id, credentials = await self.vca_map[vca_type].create_execution_environment(
namespace=namespace,
reuse_ee_id=ee_id,
"filter": {"_id": nsr_id},
"path": nsr_db_path}
- kdu_instance = await self.k8scluster_map[k8sclustertype].install(
+ kdu_instance = self.k8scluster_map[k8sclustertype].generate_kdu_instance_name(
+ db_dict=db_dict_install,
+ kdu_model=k8s_instance_info["kdu-model"],
+ )
+ self.update_db_2("nsrs", nsr_id, {nsr_db_path + ".kdu-instance": kdu_instance})
+ await self.k8scluster_map[k8sclustertype].install(
cluster_uuid=k8s_instance_info["k8scluster-uuid"],
kdu_model=k8s_instance_info["kdu-model"],
atomic=True,
db_dict=db_dict_install,
timeout=timeout,
kdu_name=k8s_instance_info["kdu-name"],
- namespace=k8s_instance_info["namespace"])
+ namespace=k8s_instance_info["namespace"],
+ kdu_instance=kdu_instance,
+ )
self.update_db_2("nsrs", nsr_id, {nsr_db_path + ".kdu-instance": kdu_instance})
# Obtain services to obtain management service ip
db_dict = {}
artifact_path = "helm_sample_charm"
helm_chart_id = "helm_sample_charm_0001"
- self.helm_conn._k8sclusterhelm3.install = asynctest.CoroutineMock(return_value=helm_chart_id)
+ self.helm_conn._k8sclusterhelm3.install = asynctest.CoroutineMock(return_value=None)
+ self.helm_conn._k8sclusterhelm3.generate_kdu_instance_name = Mock()
+ self.helm_conn._k8sclusterhelm3.generate_kdu_instance_name.return_value = helm_chart_id
+ self.helm_conn._k8sclusterhelm2.generate_kdu_instance_name = Mock()
+ self.helm_conn._k8sclusterhelm2.generate_kdu_instance_name.return_value = helm_chart_id
+
self.db.get_one.return_value = {"_admin": {"helm-chart-v3": {"id": "myk8s_id"}}}
ee_id, _ = await self.helm_conn.create_execution_environment(namespace,
db_dict,
"Check ee_id format: <helm-version>:<default namespace>.<helm_chart-id>")
self.helm_conn._k8sclusterhelm3.install.assert_called_once_with("myk8s_id",
kdu_model="/helm_sample_charm",
+ kdu_instance=helm_chart_id,
namespace="osm", db_dict=db_dict,
params=None, timeout=None)
db_vnfds = [db_vnfd]
task_register = {}
logging_text = "KDU"
- self.my_ns.k8sclusterhelm3.install = asynctest.CoroutineMock(return_value="k8s_id")
+ self.my_ns.k8sclusterhelm3.generate_kdu_instance_name = asynctest.mock.Mock()
+ self.my_ns.k8sclusterhelm3.generate_kdu_instance_name.return_value = "k8s_id"
+ self.my_ns.k8sclusterhelm3.install = asynctest.CoroutineMock()
self.my_ns.k8sclusterhelm3.synchronize_repos = asynctest.CoroutineMock(return_value=("", ""))
self.my_ns.k8sclusterhelm3.get_services = asynctest.CoroutineMock(return_value=([]))
await self.my_ns.deploy_kdus(logging_text, nsr_id, nslcmop_id, db_vnfrs, db_vnfds, task_register)