Fix deploy when subcharts contain same name 61/70761/3
authorMike Elliott <mike.elliott@amdocs.com>
Thu, 18 Oct 2018 18:43:14 +0000 (14:43 -0400)
committerMike Elliott <mike.elliott@amdocs.com>
Thu, 18 Oct 2018 19:02:20 +0000 (15:02 -0400)
Invalid subchart override file (internal) was being created
for portal. This was caused by an incorrect match on subcharts
that included "portal as a prefix or suffix in its name.

Change-Id: I02d9564f573cf194940df7edc267079e2fb7eec2
Issue-ID: OOM-1344
Signed-off-by: Mike Elliott <mike.elliott@amdocs.com>
kubernetes/common/common/templates/_repository.tpl
kubernetes/helm/plugins/deploy/deploy.sh
kubernetes/onap/values.yaml

index 364ba7d..272db42 100644 (file)
@@ -41,6 +41,7 @@
 */}}
 {{- define "common.repository.secret" -}}
   {{- $repo := include "common.repository" . }}
+  {{- $repo := default "nexus3.onap.org:10001" $repo }}
   {{- $cred := .Values.global.repositoryCred }}
   {{- $mail := default "@" $cred.mail }}
   {{- $auth := printf "%s:%s" $cred.user $cred.password | b64enc }}
index 41873b9..9d9d1d2 100755 (executable)
@@ -67,11 +67,11 @@ generate_overrides() {
     if [[ $START == "global:" ]]; then
       echo "global:" > $GLOBAL_OVERRIDES
       cat $COMPUTED_OVERRIDES | sed '/common:/,/consul:/d' \
-        | sed -n '/'"$START"'/,/'log:'/p' | sed '1d;$d' >> $GLOBAL_OVERRIDES  
+        | sed -n '/'"$START"'/,/'log:'/p' | sed '1d;$d' >> $GLOBAL_OVERRIDES
     else
       SUBCHART_DIR="$CACHE_SUBCHART_DIR/$(cut -d':' -f1 <<<"$START")"
       if [[ -d "$SUBCHART_DIR" ]]; then
-        cat $COMPUTED_OVERRIDES | sed -n '/'"$START"'/,/'"$END"'/p' \
+        cat $COMPUTED_OVERRIDES | sed -n '/^'"$START"'/,/^'"$END"'/p' \
           | sed '1d;$d' | cut -c3- > $SUBCHART_DIR/subchart-overrides.yaml
       fi
     fi
@@ -122,6 +122,10 @@ deploy() {
     FLAGS="$(echo $FLAGS| sed -n 's/--verbose//p')"
     VERBOSE="true"
   fi
+  if [[ $FLAGS = *"--dry-run"* ]]; then
+    VERBOSE="true"
+    FLAGS="$FLAGS --debug"
+  fi
 
   # should pass all flags instead
   NAMESPACE="$(echo $FLAGS | sed -n 's/.*\(namespace\).\s*/\1/p' | cut -c10- | cut -d' ' -f1)"
@@ -188,10 +192,10 @@ deploy() {
     helm upgrade -i $RELEASE $CHART_DIR $DEPLOY_FLAGS -f $COMPUTED_OVERRIDES \
      > $LOG_FILE.log 2>&1
 
-    echo "release $RELEASE deployed"
-
     if [[ $VERBOSE == "true" ]]; then
       cat $LOG_FILE
+    else
+      echo "release $RELEASE deployed"
     fi
   fi
 
@@ -214,10 +218,10 @@ deploy() {
          $DEPLOY_FLAGS -f $GLOBAL_OVERRIDES -f $SUBCHART_OVERRIDES \
          > $LOG_FILE 2>&1
 
-        echo "release ${RELEASE}-${subchart} deployed"
-
         if [[ $VERBOSE == "true" ]]; then
           cat $LOG_FILE
+        else
+          echo "release ${RELEASE}-${subchart} deployed"
         fi
       fi
     else
index 545a7bd..190a9ec 100644 (file)
@@ -47,15 +47,11 @@ global:
   persistence:
     mountPath: /dockerdata-nfs
 
-  # flag to enable debugging - application support required
-  debugEnabled: false
-
   # override default resource limit flavor for all charts
   flavor: unlimited
 
-# Repository for creation of nexus3.onap.org secret
-repository: nexus3.onap.org:10001
-
+  # flag to enable debugging - application support required
+  debugEnabled: false
 
 #################################################################
 # Enable/disable and configure helm charts (ie. applications)