Make vca config optional in lcm charm 55/10755/3
authorDavid Garcia <david.garcia@canonical.com>
Wed, 5 May 2021 19:13:58 +0000 (21:13 +0200)
committerDavid Garcia <david.garcia@canonical.com>
Fri, 7 May 2021 09:19:23 +0000 (11:19 +0200)
Change-Id: I8bf4ec4d025b3fe843501e1c3d24ac1641cb870b
Signed-off-by: David Garcia <david.garcia@canonical.com>
installers/charm/bundles/osm-ha/bundle.yaml
installers/charm/bundles/osm/bundle.yaml
installers/charm/lcm/config.yaml
installers/charm/lcm/src/charm.py
installers/charmed_install.sh

index 3ffac1a..0843115 100644 (file)
@@ -110,7 +110,7 @@ applications:
       gui-x: 600
       gui-y: 0
   lcm:
-    charm: "cs:~charmed-osm/lcm-4"
+    charm: "cs:~charmed-osm/lcm-5"
     scale: 3
     series: kubernetes
     options:
index cd3a2a6..824ff4c 100644 (file)
@@ -103,7 +103,7 @@ applications:
       gui-x: 600
       gui-y: 0
   lcm:
-    charm: "cs:~charmed-osm/lcm-4"
+    charm: "cs:~charmed-osm/lcm-5"
     scale: 1
     series: kubernetes
     options:
index 0f0cebb..f33d606 100644 (file)
@@ -23,38 +23,30 @@ options:
   vca_host:
     type: string
     description: "The VCA host."
-    default: "admin"
   vca_port:
     type: int
     description: "The VCA port."
-    default: 17070
   vca_user:
     type: string
     description: "The VCA user name."
-    default: "admin"
   vca_secret:
     type: string
     description: "The VCA user secret."
-    default: "secret"
   vca_pubkey:
     type: string
     description: "The VCA public key."
-    default: "secret"
   vca_cacert:
     type: string
     description: "The VCA cacert."
   vca_apiproxy:
     type: string
     description: "The VCA api proxy (native charms)"
-    default: ""
   vca_cloud:
     type: string
     description: "The VCA lxd cloud name"
-    default: "localhost"
   vca_k8s_cloud:
     type: string
     description: "The VCA K8s cloud name"
-    default: "k8scloud"
   database_commonkey:
     description: Database common key
     type: string
index 52bc5cf..10257ba 100755 (executable)
@@ -42,14 +42,14 @@ PORT = 9999
 
 
 class ConfigModel(ModelValidator):
-    vca_host: str
-    vca_port: int
-    vca_user: str
-    vca_secret: str
-    vca_pubkey: str
-    vca_cacert: str
-    vca_cloud: str
-    vca_k8s_cloud: str
+    vca_host: Optional[str]
+    vca_port: Optional[int]
+    vca_user: Optional[str]
+    vca_secret: Optional[str]
+    vca_pubkey: Optional[str]
+    vca_cacert: Optional[str]
+    vca_cloud: Optional[str]
+    vca_k8s_cloud: Optional[str]
     database_commonkey: str
     mongodb_uri: Optional[str]
     log_level: str
@@ -190,29 +190,32 @@ class LcmCharm(CharmedOsmBase):
                 "OSMLCM_STORAGE_PATH": "/app/storage",
                 "OSMLCM_STORAGE_COLLECTION": "files",
                 "OSMLCM_STORAGE_URI": self.mongodb_client.connection_string,
-                # VCA configuration
-                "OSMLCM_VCA_HOST": config.vca_host,
-                "OSMLCM_VCA_PORT": config.vca_port,
-                "OSMLCM_VCA_USER": config.vca_user,
-                "OSMLCM_VCA_PUBKEY": config.vca_pubkey,
-                "OSMLCM_VCA_SECRET": config.vca_secret,
-                "OSMLCM_VCA_CACERT": config.vca_cacert,
-                "OSMLCM_VCA_CLOUD": config.vca_cloud,
-                "OSMLCM_VCA_K8S_CLOUD": config.vca_k8s_cloud,
             }
         )
-        if config.vca_apiproxy:
-            container_builder.add_env("OSMLCM_VCA_APIPROXY", config.vca_apiproxy)
-
-        model_config_envs = {
-            f"OSMLCM_{k.upper()}": v
-            for k, v in self.config.items()
-            if k.startswith("vca_model_config")
-        }
-
-        if model_config_envs:
-            container_builder.add_envs(model_config_envs)
-
+        if config.vca_host:
+            container_builder.add_envs(
+                {
+                    # VCA configuration
+                    "OSMLCM_VCA_HOST": config.vca_host,
+                    "OSMLCM_VCA_PORT": config.vca_port,
+                    "OSMLCM_VCA_USER": config.vca_user,
+                    "OSMLCM_VCA_PUBKEY": config.vca_pubkey,
+                    "OSMLCM_VCA_SECRET": config.vca_secret,
+                    "OSMLCM_VCA_CACERT": config.vca_cacert,
+                    "OSMLCM_VCA_CLOUD": config.vca_cloud,
+                    "OSMLCM_VCA_K8S_CLOUD": config.vca_k8s_cloud,
+                }
+            )
+            if config.vca_apiproxy:
+                container_builder.add_env("OSMLCM_VCA_APIPROXY", config.vca_apiproxy)
+
+            model_config_envs = {
+                f"OSMLCM_{k.upper()}": v
+                for k, v in self.config.items()
+                if k.startswith("vca_model_config")
+            }
+            if model_config_envs:
+                container_builder.add_envs(model_config_envs)
         container = container_builder.build()
 
         # Add container to pod spec
index 123b29c..d77e846 100755 (executable)
@@ -25,8 +25,8 @@ PATH=/snap/bin:${PATH}
 
 MODEL_NAME=osm
 
-OSM_BUNDLE=cs:osm-61
-OSM_HA_BUNDLE=cs:osm-ha-46
+OSM_BUNDLE=cs:osm-62
+OSM_HA_BUNDLE=cs:osm-ha-47
 TAG=testing-daily
 
 function check_arguments(){