Load Gitops configuration properly in OduWorkflow class 50/14550/3
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 11 Sep 2024 12:30:26 +0000 (14:30 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 11 Sep 2024 13:24:03 +0000 (15:24 +0200)
Change-Id: Id061c4e4da1b8f5bb665d6bfb1d9bb33d192a520
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_lcm/data_utils/lcm_config.py
osm_lcm/lcm.cfg
osm_lcm/odu_workflows.py

index 5ad9bd1..b88c55d 100644 (file)
@@ -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
index 1b26c7d..b77e33c 100644 (file)
@@ -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.<IP_ADDRESS>.nip.io
+    user:              osm-developer
+    # git_base_url:          http://git.<IP_ADDRESS>.nip.io
     # pubkey:                 pubkey
 
index b882706..c992f17 100644 (file)
@@ -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 = {