From: garciadeblas Date: Wed, 11 Sep 2024 12:30:26 +0000 (+0200) Subject: Load Gitops configuration properly in OduWorkflow class X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=3364c47a8484802bf6ffaf48fbd214224596259b;p=osm%2FLCM.git Load Gitops configuration properly in OduWorkflow class Change-Id: Id061c4e4da1b8f5bb665d6bfb1d9bb33d192a520 Signed-off-by: garciadeblas --- diff --git a/osm_lcm/data_utils/lcm_config.py b/osm_lcm/data_utils/lcm_config.py index 5ad9bd1..b88c55d 100644 --- a/osm_lcm/data_utils/lcm_config.py +++ b/osm_lcm/data_utils/lcm_config.py @@ -29,6 +29,7 @@ class OsmConfigman(ConfigMan): super().__init__() self.set_from_dict(config_dict) self.set_auto_env("OSMLCM") + self.set_auto_env("OSM") def get(self, key, defaultValue): return self.to_dict()[key] @@ -206,10 +207,10 @@ class MonitoringConfig(OsmConfigman): class GitopsConfig(OsmConfigman): - repo_base_url: str = None - repo_user: str = None + git_base_url: str = None + user: str = None pubkey: str = None - mgmtcluster_kubeconfig: str = "/etc/osm/mgmtcluster-kubeconfig.yaml" + mgmtcluster_kubeconfig: str = None loglevel: str = "DEBUG" logfile: str = None logger_name: str = None diff --git a/osm_lcm/lcm.cfg b/osm_lcm/lcm.cfg index 1b26c7d..b77e33c 100644 --- a/osm_lcm/lcm.cfg +++ b/osm_lcm/lcm.cfg @@ -93,7 +93,7 @@ tsdb: # time series database gitops: mgmtcluster_kubeconfig: /etc/osm/mgmtcluster-kubeconfig.yaml - repo_user: osm-developer - # repo_base_url: http://git..nip.io + user: osm-developer + # git_base_url: http://git..nip.io # pubkey: pubkey diff --git a/osm_lcm/odu_workflows.py b/osm_lcm/odu_workflows.py index b882706..c992f17 100644 --- a/osm_lcm/odu_workflows.py +++ b/osm_lcm/odu_workflows.py @@ -33,16 +33,13 @@ class OduWorkflow(LcmBase): self.logger.info("Msg: {} lcm_tasks: {} ".format(msg, lcm_tasks)) # self._kubeconfig = kubeconfig # TODO: get it from config - self._kubeconfig = "/etc/osm/mgmtcluster-kubeconfig.yaml" + self.gitops_config = config["gitops"] + self.logger.debug(f"Config: {self.gitops_config}") + self._kubeconfig = self.gitops_config["mgmtcluster_kubeconfig"] self._kubectl = kubectl.Kubectl(config_file=self._kubeconfig) - # self._repo_base_url = repo_base_url - # self._repo_user = repo_user - # self._pubkey = pubkey - self._repo_base_url = ( - "http://git.172.21.249.24.nip.io" # TODO: get it from config - ) - self._repo_user = "osm-developer" # TODO: get it from config - self._pubkey = "age1wnfvymrm4w9kfz8vn98lmu8c4w9e2wjd2v7u9lx7m3gn6patc4vqpralhx" # TODO: get it from config + self._repo_base_url = self.gitops_config["git_base_url"] + self._repo_user = self.gitops_config["user"] + self._pubkey = self.gitops_config["pubkey"] self._workflow_debug = "true" self._workflow_dry_run = "false" self._workflows = {