####################################################################################
"""
service_account = "osm"
+ _STABLE_REPO_URL = "https://charts.helm.sh/stable"
def __init__(
self,
helm_command: str = "/usr/bin/helm",
log: object = None,
on_update_db=None,
+ vca_config: dict = None,
):
"""
self._helm_command = helm_command
self._check_file_exists(filename=helm_command, exception_if_not_exists=True)
+ # obtain stable repo url from config or apply default
+ if not vca_config or not vca_config.get("stablerepourl"):
+ self._stable_repo_url = self._STABLE_REPO_URL
+ else:
+ self._stable_repo_url = vca_config.get("stablerepourl")
+
@staticmethod
def _get_namespace_cluster_id(cluster_uuid: str) -> (str, str):
"""
kdu_model: str,
paths: dict,
env: dict,
+ kdu_instance: str,
atomic: bool = True,
timeout: float = 300,
params: dict = None,
version = str(parts[1])
kdu_model = parts[0]
- # generate a name for the release. Then, check if already exists
- kdu_instance = None
- while kdu_instance is None:
- kdu_instance = self._generate_release_name(kdu_model)
- try:
- result = await self._status_kdu(
- cluster_id=cluster_id,
- kdu_instance=kdu_instance,
- namespace=namespace,
- show_error_log=False,
- )
- if result is not None:
- # instance already exists: generate a new one
- kdu_instance = None
- except K8sException:
- pass
-
command = self._get_install_command(kdu_model, kdu_instance, namespace,
params_str, version, atomic, timeout)
self.log.error(msg)
raise K8sException(msg)
- return kdu_instance
-
async def upgrade(
self,
cluster_uuid: str,
# look for instance to obtain namespace
instance_info = await self.get_instance_info(cluster_uuid, kdu_instance)
if not instance_info:
- raise K8sException("kdu_instance {} not found".format(kdu_instance))
-
+ self.log.warning(("kdu_instance {} not found".format(kdu_instance)))
+ return True
# init env, paths
paths, env = self._init_paths_env(
cluster_name=cluster_id, create_if_not_exist=True
return params_str
@staticmethod
- def _generate_release_name(chart_name: str):
+ def generate_kdu_instance_name(**kwargs):
+ chart_name = kwargs["kdu_model"]
# check embeded chart (file or dir)
if chart_name.startswith("/"):
# extract file or directory name