X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Fk8s_helm_conn.py;h=b367e7421cc02a54b8e06d632ca67d279f3616e3;hp=ff1f33112c1629fa2294853b9c3be92c01b52de5;hb=d5d83a4250eebe2e82fcb9986bcc1d3db5610c3d;hpb=bc269eb13d444b0e382a38a710e13abb87f5c342 diff --git a/n2vc/k8s_helm_conn.py b/n2vc/k8s_helm_conn.py index ff1f331..b367e74 100644 --- a/n2vc/k8s_helm_conn.py +++ b/n2vc/k8s_helm_conn.py @@ -327,7 +327,8 @@ class K8sHelmConnector(K8sConnector): timeout: float = 300, params: dict = None, db_dict: dict = None, - kdu_name: str = None + kdu_name: str = None, + namespace: str = None ): self.log.debug('installing {} in cluster {}'.format(kdu_model, cluster_uuid)) @@ -348,6 +349,10 @@ class K8sHelmConnector(K8sConnector): atomic_str = '' if atomic: atomic_str = '--atomic' + # namespace + namespace_str = '' + if namespace: + namespace_str = "--namespace {}".format(namespace) # version version_str = '' @@ -374,9 +379,11 @@ class K8sHelmConnector(K8sConnector): pass # helm repo install - command = '{} install {} --output yaml --kubeconfig={} --home={} {} {} --name={} {} {}'\ - .format(self._helm_command, atomic_str, config_filename, helm_dir, - params_str, timeout_str, kdu_instance, kdu_model, version_str) + command = '{helm} install {atomic} --output yaml --kubeconfig={config} --home={dir} {params} {timeout} ' \ + '--name={name} {ns} {model} {ver}'.format(helm=self._helm_command, atomic=atomic_str, + config=config_filename, dir=helm_dir, params=params_str, + timeout=timeout_str, name=kdu_instance, ns=namespace_str, + model=kdu_model, ver=version_str) self.log.debug('installing: {}'.format(command)) if atomic: @@ -1200,13 +1207,13 @@ class K8sHelmConnector(K8sConnector): return '', -1 def _check_file_exists(self, filename: str, exception_if_not_exists: bool = False): - self.log.debug('Checking if file {} exists...'.format(filename)) + # self.log.debug('Checking if file {} exists...'.format(filename)) if os.path.exists(filename): return True else: msg = 'File {} does not exist'.format(filename) if exception_if_not_exists: - self.log.error(msg) + # self.log.error(msg) raise K8sException(msg)