summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
28b0bf8)
The function create_execution_environment has been updated
to allow the deployment from a file or from a reference
(repo/name:version).
This will call to the N2VC Helm connector to install the execution
environment in the local environment.
Change-Id: I03c8e95bf0f6a55d3f62bc7a55dabe3a9b348cde
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
total_timeout: float = None,
config: dict = None,
artifact_path: str = None,
total_timeout: float = None,
config: dict = None,
artifact_path: str = None,
+ chart_model: str = None,
vca_type: str = None,
*kargs,
**kwargs,
) -> (str, dict):
"""
Creates a new helm execution environment deploying the helm-chat indicated in the
vca_type: str = None,
*kargs,
**kwargs,
) -> (str, dict):
"""
Creates a new helm execution environment deploying the helm-chat indicated in the
:param str namespace: This param is not used, all helm charts are deployed in the osm
system namespace
:param dict db_dict: where to write to database when the status changes.
It contains a dictionary with {collection: str, filter: {}, path: str},
e.g. {collection: "nsrs", filter: {_id: <nsd-id>, path:
"_admin.deployed.VCA.3"}
:param str namespace: This param is not used, all helm charts are deployed in the osm
system namespace
:param dict db_dict: where to write to database when the status changes.
It contains a dictionary with {collection: str, filter: {}, path: str},
e.g. {collection: "nsrs", filter: {_id: <nsd-id>, path:
"_admin.deployed.VCA.3"}
- :param str reuse_ee_id: ee id from an older execution. TODO - right now this params is not used
+ :param str reuse_ee_id: ee id from an older execution. TODO - right now this param is not used
:param float progress_timeout:
:param float total_timeout:
:param dict config: General variables to instantiate KDU
:param float progress_timeout:
:param float total_timeout:
:param dict config: General variables to instantiate KDU
- :param str artifact_path: path of package content
+ :param str artifact_path: path of package content
+ :param str chart_model: helm chart/reference (string), which can be either
+ of these options:
+ - a name of chart available via the repos known by OSM
+ (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
: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
"""
self.log.info(
:param str vca_type: Type of vca, must be type helm or 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
"""
self.log.info(
- "create_execution_environment: namespace: {}, artifact_path: {}, db_dict: {}, "
- "reuse_ee_id: {}".format(namespace, artifact_path, db_dict, reuse_ee_id)
+ "create_execution_environment: namespace: {}, artifact_path: {}, "
+ "chart_model: {}, db_dict: {}, reuse_ee_id: {}".format(
+ namespace, artifact_path, db_dict, chart_model, reuse_ee_id
+ )
)
# Validate artifact-path is provided
)
# Validate artifact-path is provided
while full_path.find("//") >= 0:
full_path = full_path.replace("//", "/")
while full_path.find("//") >= 0:
full_path = full_path.replace("//", "/")
+ # By default, the KDU is expected to be a file
+ kdu_model = full_path
+ # If the chart_model includes a "/", then it is a reference:
+ # e.g. (stable/openldap; stable/openldap:1.2.4)
+ if chart_model.find("/") >= 0:
+ kdu_model = chart_model
+
try:
# Call helm conn install
# Obtain system cluster id from database
try:
# Call helm conn install
# Obtain system cluster id from database
if vca_type == "helm":
helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
db_dict=db_dict,
if vca_type == "helm":
helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
db_dict=db_dict,
)
await self._k8sclusterhelm2.install(
system_cluster_uuid,
)
await self._k8sclusterhelm2.install(
system_cluster_uuid,
kdu_instance=helm_id,
namespace=self._KUBECTL_OSM_NAMESPACE,
params=config,
kdu_instance=helm_id,
namespace=self._KUBECTL_OSM_NAMESPACE,
params=config,
else:
helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
db_dict=db_dict,
else:
helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
db_dict=db_dict,
)
await self._k8sclusterhelm3.install(
system_cluster_uuid,
)
await self._k8sclusterhelm3.install(
system_cluster_uuid,
kdu_instance=helm_id,
namespace=self._KUBECTL_OSM_NAMESPACE,
params=config,
kdu_instance=helm_id,
namespace=self._KUBECTL_OSM_NAMESPACE,
params=config,
db_dict=db_dict,
config=osm_config,
artifact_path=artifact_path,
db_dict=db_dict,
config=osm_config,
artifact_path=artifact_path,
vca_type=vca_type,
)
else:
vca_type=vca_type,
)
else:
# STEP 7 Configure metrics
if vca_type == "helm" or vca_type == "helm-v3":
# STEP 7 Configure metrics
if vca_type == "helm" or vca_type == "helm-v3":
+ # TODO: review for those cases where the helm chart is a reference and
+ # is not part of the NF package
prometheus_jobs = await self.extract_prometheus_scrape_jobs(
ee_id=ee_id,
artifact_path=artifact_path,
prometheus_jobs = await self.extract_prometheus_scrape_jobs(
ee_id=ee_id,
artifact_path=artifact_path,
namespace = "testnamespace"
db_dict = {}
artifact_path = "helm_sample_charm"
namespace = "testnamespace"
db_dict = {}
artifact_path = "helm_sample_charm"
+ chart_model = "helm_sample_charm"
helm_chart_id = "helm_sample_charm_0001"
self.helm_conn._k8sclusterhelm3.install = asynctest.CoroutineMock(
return_value=None
helm_chart_id = "helm_sample_charm_0001"
self.helm_conn._k8sclusterhelm3.install = asynctest.CoroutineMock(
return_value=None
self.db.get_one.return_value = {"_admin": {"helm-chart-v3": {"id": "myk8s_id"}}}
ee_id, _ = await self.helm_conn.create_execution_environment(
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, artifact_path=artifact_path, vca_type="helm-v3"
+ namespace, db_dict, artifact_path=artifact_path,
+ chart_model=chart_model, vca_type="helm-v3"
)
self.assertEqual(
ee_id,
)
self.assertEqual(
ee_id,