from osm_lcm.data_utils.filesystem.filesystem import Filesystem
from n2vc.n2vc_conn import N2VCConnector
-from n2vc.k8s_helm_conn import K8sHelmConnector
from n2vc.k8s_helm3_conn import K8sHelm3Connector
from n2vc.exceptions import (
N2VCBadArgumentsException,
self._max_retry_time = self.vca_config.helm_max_retry_time
self.log.debug("Retry time: {}".format(self._max_retry_time))
- # initialize helm connector for helmv2 and helmv3
- self._k8sclusterhelm2 = K8sHelmConnector(
- kubectl_command=self.vca_config.kubectlpath,
- helm_command=self.vca_config.helmpath,
- fs=self.fs,
- db=self.db,
- log=self.log,
- on_update_db=None,
- )
-
+ # initialize helm connector for helmv3
self._k8sclusterhelm3 = K8sHelm3Connector(
kubectl_command=self.vca_config.kubectlpath,
helm_command=self.vca_config.helm3path,
(e.g. stable/openldap, stable/openldap:1.2.4)
- a path to a packaged chart (e.g. mychart.tgz)
- a path to an unpacked chart directory or a URL (e.g. mychart)
- :param str vca_type: Type of vca, must be type helm or helm-v3
+ :param str vca_type: Type of vca, must be type helm-v3
:returns str, dict: id of the new execution environment including namespace.helm_id
and credentials object set to None as all credentials should be osm kubernetes .kubeconfig
"""
config["global"]["osm"] = config.get("osm")
self.log.debug("install helm chart: {}".format(full_path))
- if vca_type == "helm":
- helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
- db_dict=db_dict,
- kdu_model=kdu_model,
- )
- await self._k8sclusterhelm2.install(
- system_cluster_uuid,
- kdu_model=kdu_model,
- kdu_instance=helm_id,
- namespace=namespace,
- params=config,
- db_dict=db_dict,
- timeout=progress_timeout,
- )
- else:
- helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
- db_dict=db_dict,
- kdu_model=kdu_model,
- )
- await self._k8sclusterhelm3.install(
- system_cluster_uuid,
- kdu_model=kdu_model,
- kdu_instance=helm_id,
- namespace=namespace,
- params=config,
- db_dict=db_dict,
- timeout=progress_timeout,
- )
+ helm_id = self._k8sclusterhelm3.generate_kdu_instance_name(
+ db_dict=db_dict,
+ kdu_model=kdu_model,
+ )
+ await self._k8sclusterhelm3.install(
+ system_cluster_uuid,
+ kdu_model=kdu_model,
+ kdu_instance=helm_id,
+ namespace=namespace,
+ params=config,
+ db_dict=db_dict,
+ timeout=progress_timeout,
+ )
ee_id = "{}:{}.{}".format(vca_type, namespace, helm_id)
return ee_id, None
:param float total_timeout:
:param dict config: General variables to instantiate KDU
:param str artifact_path: path of package content
- :param str vca_type: Type of vca, must be type helm or helm-v3
+ :param str vca_type: Type of vca, must be type helm-v3
:returns str, dict: id of the new execution environment including namespace.helm_id
and credentials object set to None as all credentials should be osm kubernetes .kubeconfig
"""
config["global"]["osm"] = config.get("osm")
self.log.debug("Ugrade helm chart: {}".format(full_path))
- if vca_type == "helm":
- await self._k8sclusterhelm2.upgrade(
- system_cluster_uuid,
- kdu_model=full_path,
- kdu_instance=helm_id,
- namespace=namespace,
- params=config,
- db_dict=db_dict,
- timeout=progress_timeout,
- force=True,
- )
- else:
- await self._k8sclusterhelm3.upgrade(
- system_cluster_uuid,
- kdu_model=full_path,
- kdu_instance=helm_id,
- namespace=namespace,
- params=config,
- db_dict=db_dict,
- timeout=progress_timeout,
- force=True,
- )
+ await self._k8sclusterhelm3.upgrade(
+ system_cluster_uuid,
+ kdu_model=full_path,
+ kdu_instance=helm_id,
+ namespace=namespace,
+ params=config,
+ db_dict=db_dict,
+ timeout=progress_timeout,
+ force=True,
+ )
except N2VCException:
raise
# Get helm_id
version, namespace, helm_id = get_ee_id_parts(ee_id)
- # Uninstall chart, for backward compatibility we must assume that if there is no
- # version it is helm-v2
- if version == "helm-v3":
- await self._k8sclusterhelm3.uninstall(system_cluster_uuid, helm_id)
- else:
- await self._k8sclusterhelm2.uninstall(system_cluster_uuid, helm_id)
+ await self._k8sclusterhelm3.uninstall(system_cluster_uuid, helm_id)
self.log.info("ee_id: {} deleted".format(ee_id))
except N2VCException:
raise