Make PLA optional in charmed installer 16/12516/8
authorPatricia Reinoso <patricia.reinoso@canonical.com>
Thu, 1 Sep 2022 13:18:13 +0000 (15:18 +0200)
committerreinosop <patricia.reinoso@canonical.com>
Tue, 13 Sep 2022 09:07:00 +0000 (11:07 +0200)
PLA is no longer installed by default for
the charmed installer
flag --pla is needed

Change-Id: Ib0ea0691fd53884dc5bf11d067e9f9d9df55c876
Signed-off-by: Patricia Reinoso <patricia.reinoso@canonical.com>
installers/charm/bundles/osm-ha/bundle.yaml
installers/charm/bundles/osm/bundle.yaml
installers/charmed_install.sh

index 7d1a446..166cb00 100644 (file)
@@ -122,15 +122,6 @@ applications:
     charm: nginx-ingress-integrator
     channel: latest/stable
     scale: 3
-  pla:
-    charm: osm-pla
-    channel: latest/stable
-    scale: 3
-    series: kubernetes
-    options:
-      log_level: DEBUG
-    resources:
-      image: opensourcemano/pla:testing-daily
   prometheus:
     charm: osm-prometheus
     channel: latest/stable
@@ -180,10 +171,6 @@ relations:
     - kafka:kafka
   - - mon:vca
     - vca:vca
-  - - pla:kafka
-    - kafka:kafka
-  - - pla:mongodb
-    - mongodb:database
   - - nbi:mongodb
     - mongodb:database
   - - nbi:kafka
index f9fc6b9..64e73cd 100644 (file)
@@ -120,15 +120,6 @@ applications:
     charm: nginx-ingress-integrator
     channel: latest/stable
     scale: 1
-  pla:
-    charm: osm-pla
-    channel: latest/stable
-    scale: 1
-    series: kubernetes
-    options:
-      log_level: DEBUG
-    resources:
-      image: opensourcemano/pla:testing-daily
   prometheus:
     charm: osm-prometheus
     channel: latest/stable
@@ -178,10 +169,6 @@ relations:
     - kafka:kafka
   - - mon:vca
     - vca:vca
-  - - pla:kafka
-    - kafka:kafka
-  - - pla:mongodb
-    - mongodb:database
   - - nbi:mongodb
     - mongodb:database
   - - nbi:kafka
index 844e646..2cd9a07 100755 (executable)
@@ -26,6 +26,9 @@ IMAGES_OVERLAY_FILE=~/.osm/images-overlay.yaml
 PASSWORD_OVERLAY_FILE=~/.osm/password-overlay.yaml
 PATH=/snap/bin:${PATH}
 OSM_DEVOPS="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. &> /dev/null && pwd )"
+INSTALL_PLA=""
+PLA_OVERLAY_FILE=~/.osm/pla-overlay.yaml
+
 if [ -f ${OSM_DEVOPS}/common/all_funcs ] ; then
     source ${OSM_DEVOPS}/common/all_funcs
 else
@@ -59,6 +62,7 @@ function check_arguments(){
             --tag) TAG="$2" ;;
             --registry) REGISTRY_INFO="$2" ;;
             --only-vca) ONLY_VCA=y ;;
+            --pla) INSTALL_PLA=y ;;
         esac
         shift
     done
@@ -254,10 +258,12 @@ function deploy_charmed_osm(){
 
     generate_password_overlay && secret_overlay="--overlay $PASSWORD_OVERLAY_FILE"
 
+    [ -n "$INSTALL_PLA" ] && create_pla_overlay && pla_overlay="--overlay $PLA_OVERLAY_FILE"
+
     if [ -v BUNDLE ]; then
-        juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $BUNDLE $images_overlay $extra_overlay $secret_overlay
+        juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $BUNDLE $images_overlay $extra_overlay $secret_overlay $pla_overlay
     else
-        juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $OSM_BUNDLE $images_overlay $extra_overlay $secret_overlay
+        juju deploy --trust --channel $CHARMHUB_CHANNEL -m $MODEL_NAME $OSM_BUNDLE $images_overlay $extra_overlay $secret_overlay $pla_overlay
     fi
 
     if [ ! -v KUBECFG ]; then
@@ -295,7 +301,8 @@ function deploy_charmed_osm(){
 function check_osm_deployed() {
     TIME_TO_WAIT=600
     start_time="$(date -u +%s)"
-    total_service_count=16
+    total_service_count=15
+    [ -n "$INSTALL_PLA" ] && total_service_count=$((total_service_count + 1))
     previous_count=0
     while true
     do
@@ -345,10 +352,34 @@ EOF
     mv /tmp/password-overlay.yaml $PASSWORD_OVERLAY_FILE
 }
 
+function create_pla_overlay(){
+    echo "Creating PLA Overlay"
+    [ $BUNDLE == $OSM_HA_BUNDLE ] && scale=3 || scale=1
+    cat << EOF > /tmp/pla-overlay.yaml
+applications:
+  pla:
+    charm: osm-pla
+    channel: latest/stable
+    scale: $scale
+    series: kubernetes
+    options:
+      log_level: DEBUG
+    resources:
+      image: opensourcemano/pla:testing-daily
+relations:
+  - - pla:kafka
+    - kafka:kafka
+  - - pla:mongodb
+    - mongodb:database
+EOF
+     mv /tmp/pla-overlay.yaml $PLA_OVERLAY_FILE
+}
+
 function generate_images_overlay(){
     echo "applications:" > /tmp/images-overlay.yaml
 
-    charms_with_resources="nbi lcm mon pol ng-ui ro pla"
+    charms_with_resources="nbi lcm mon pol ng-ui ro"
+    [ -n "$INSTALL_PLA" ] && charms_with_resources+=" pla"
     for charm in $charms_with_resources; do
         cat << EOF > /tmp/${charm}_registry.yaml
 registrypath: ${REGISTRY_URL}opensourcemano/${charm}:$TAG