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
- attifact_path
+ artifact_path
: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 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(
- "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
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
if vca_type == "helm":
helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
db_dict=db_dict,
- kdu_model=full_path,
+ kdu_model=kdu_model,
)
await self._k8sclusterhelm2.install(
system_cluster_uuid,
- kdu_model=full_path,
+ kdu_model=kdu_model,
kdu_instance=helm_id,
namespace=self._KUBECTL_OSM_NAMESPACE,
params=config,
else:
helm_id = self._k8sclusterhelm2.generate_kdu_instance_name(
db_dict=db_dict,
- kdu_model=full_path,
+ kdu_model=kdu_model,
)
await self._k8sclusterhelm3.install(
system_cluster_uuid,
- kdu_model=full_path,
+ kdu_model=kdu_model,
kdu_instance=helm_id,
namespace=self._KUBECTL_OSM_NAMESPACE,
params=config,
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
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,