VOL-3204 - support chart specific values

supports chart specific values in a fashion that
is more similar to nested charts so everything can be
in a single file.

used this to add support to enable name overrides so that
a user can make a voltha deployment look the old way if they
choose.

Change-Id: If981f3aaf6617d8d3e4f7471f2c771a4c9a8f7f4
diff --git a/full-values.yaml b/full-values.yaml
index ab41a99..253c7b9 100644
--- a/full-values.yaml
+++ b/full-values.yaml
@@ -126,6 +126,15 @@
     KAFKA_DEFAULT_REPLICATION_FACTOR: 1
     KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
 
+# voltha:
+#   fullNameOverride: voltha
+
+# open-olt:
+#   fullNameOverride: voltha-adapter-openolt
+
+# open-onu:
+#   fullNameOverride: voltha-adapter-openonu
+
 onos_env:
   - name: POD_IP
     valueFrom:
diff --git a/minimal-values.yaml b/minimal-values.yaml
index 41c05b2..b9d16c6 100644
--- a/minimal-values.yaml
+++ b/minimal-values.yaml
@@ -125,6 +125,15 @@
     KAFKA_DEFAULT_REPLICATION_FACTOR: 1
     KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
 
+# voltha:
+#   fullNameOverride: voltha
+
+# open-olt:
+#   fullNameOverride: voltha-adapter-openolt
+
+# open-onu:
+#   fullNameOverride: voltha-adapter-openonu
+
 onos_env:
   - name: POD_IP
     valueFrom:
diff --git a/scripts/monitor.sh b/scripts/monitor.sh
index 2ad2d77..4621941 100755
--- a/scripts/monitor.sh
+++ b/scripts/monitor.sh
@@ -16,32 +16,58 @@
 # This script sets up a watch with information that is valuable when
 # developing voltha with k8s
 SCRIPTPATH="$( cd "$(dirname "$0")" || return  >/dev/null 2>&1 ; pwd -P )"
+__COLS=$(($(tput cols) - 1))
 
-if ! command -v kubectl >/dev/null 2>&1; then
-    >&2 echo "ERROR: 'kubectl' not in \$PATH"
-    exit 1
+echo -n "Kind (client): "
+if ! command -v kind >/dev/null 2>&1; then
+    echo "'kind' not in \$PATH"
+else
+    kind version
 fi
 
-echo "Kind (client): $(kind version)"
-kubectl version -o json | jq -r '"Kubernetes (client/server): "+.clientVersion.gitVersion+"/"+.serverVersion.gitVersion'
-helm version --template 'Helm: (client/server): {{ (index . "Client").SemVer }}/{{ (index . "Server").SemVer }}{{ printf "\n"}}'
+echo -n "Kubernetes (client/server): "
+if ! command -v kubectl >/dev/null 2>&1; then
+    echo "'kubectl' not in \$PATH"
+else
+    CLIENT=$(kubectl version --client -o json | jq -r '.clientVersion.gitVersion')
+    SERVER=$(kubectl version -o json 2>/dev/null)
+    if [ "$?" -ne 0 ]; then
+        SERVER="ERROR"
+    else
+        SERVER=$(echo $SERVER | jq -r '.serverVersion.gitVersion')
+    fi
+    echo "$CLIENT/$SERVER"
+fi
 
-echo -n "Voltctl: (client/server): "
+echo -n "Helm (client/server): "
+if ! command -v helm >/dev/null 2>&1; then
+    echo "'helm' not in \$PATH"
+else
+    CLIENT=$(helm version --client --template '{{ (index . "Client").SemVer }}')
+    SERVER=$(helm version --server --template '{{ (index . "Server").SemVer }}' 2>/dev/null)
+    if [ "$?" -ne 0 ]; then
+        SERVER="ERROR"
+    fi
+    echo "$CLIENT/$SERVER"
+fi
+
+echo -n "Voltha: (client/server): "
 if ! command -v voltctl >/dev/null 2>&1; then
     echo "'voltctl' not in \$PATH"
 else
     CLIENT=$(voltctl version --clientonly -o json | jq -r '"v"+.version')
-    JSON=$(voltctl version -o json 2>&1)
-    if [ "$?" -eq 0 ]; then
-        echo "$CLIENT/$(echo "$JSON" | jq -r '"/v"+.cluster.version' 2>&1)"
+    SERVER=$(voltctl version -o json 2>/dev/null)
+    if [ -z "$SERVER" ]; then
+        SERVER="ERROR"
     else
-        echo "$CLIENT/$JSON"
+        SERVER=$(echo "$SERVER" | jq -r '"v"+.cluster.version')
     fi
+    echo "$CLIENT/$SERVER"
 fi
 echo
-kubectl get --all-namespaces pods,svc,configmap | grep -v kube-system
+kubectl get --all-namespaces pods,svc,configmap | grep -v kube-system | cut -c -$__COLS
 echo
-kubectl  describe --all-namespaces  pods | grep Image: | grep '\(voltha\|bbsim\)' | sed -e "s/^ *//g" -e "s/: */: /g"
+kubectl  describe --all-namespaces  pods | grep Image: | grep '\(voltha\|bbsim\)' | sed -e "s/^ *//g" -e "s/: */: /g" | sort -u | cut -c -$COLS
 echo
 echo "DB SIZE: $("$SCRIPTPATH/etcd-db-size.sh")"
 echo
diff --git a/voltha b/voltha
index 820ed7a..e41d5d8 100755
--- a/voltha
+++ b/voltha
@@ -1158,6 +1158,9 @@
     VALUES_FILE="$(mktemp)"
     if [ "$FILTER" == "-" ]; then
         cp "$NAME-values.yaml" "$VALUES_FILE"
+    elif [ "${FILTER:0:1}" == "+" ]; then
+        cp "$NAME-values.yaml" "$VALUES_FILE"
+        yq r - "${FILTER:1}" <"$NAME-values.yaml" >>"$VALUES_FILE"
     else
         yq r - "$FILTER" <"$NAME-values.yaml" >"$VALUES_FILE"
     fi
@@ -1990,7 +1993,7 @@
 bspin "Verify VOLTHA installed $HIGH_VOLTAGE"
 if [ "$HELM_USE_UPGRADE" == "yes" ] || [ "$(helm list --deployed --short --namespace "$VOLTHA_NS" "^voltha\$" | wc -l)" -ne 1 ]; then
     espin "$NOT_VERIFIED"
-    helm_install - "$VOLTHA_NS" voltha "$VOLTHA_CHART" "$VOLTHA_CHART_VERSION" - "$_HELM_DESC VOLTHA Core"
+    helm_install - "$VOLTHA_NS" voltha "$VOLTHA_CHART" "$VOLTHA_CHART_VERSION" "+voltha" "$_HELM_DESC VOLTHA Core"
 else
     espin "$VERIFIED"
 fi
@@ -2044,7 +2047,7 @@
         bspin - "Verify OpenOLT Adapter installed"
         if [ "$HELM_USE_UPGRADE" == "yes" ] || [ "$(helm list --deployed --short --namespace "$ADAPTER_NS"  "^open-olt\$" | wc -l)" -ne 1 ]; then
             espin - "$NOT_VERIFIED"
-            helm_install - "$ADAPTER_NS" open-olt "$VOLTHA_ADAPTER_OPEN_OLT_CHART" "$VOLTHA_ADAPTER_OPEN_OLT_CHART_VERSION" - "$_HELM_DESC OpenOLT Adapter"
+            helm_install - "$ADAPTER_NS" open-olt "$VOLTHA_ADAPTER_OPEN_OLT_CHART" "$VOLTHA_ADAPTER_OPEN_OLT_CHART_VERSION" "+open-olt" "$_HELM_DESC OpenOLT Adapter"
         else
             espin - "$VERIFIED"
         fi
@@ -2054,7 +2057,7 @@
             _ORIGINAL_EXTRA_HELM_INSTALL_ARGS="$INTERNAL_EXTRA_HELM_INSTALL_ARGS"
             INTERNAL_EXTRA_HELM_INSTALL_ARGS+=" --set replicas.adapter_open_onu=$NUM_OF_OPENONU"
             espin - "$NOT_VERIFIED"
-            helm_install - "$ADAPTER_NS"  open-onu "$VOLTHA_ADAPTER_OPEN_ONU_CHART" "$VOLTHA_ADAPTER_OPEN_ONU_CHART_VERSION" - "$_HELM_DESC OpenONU Adapter"
+            helm_install - "$ADAPTER_NS"  open-onu "$VOLTHA_ADAPTER_OPEN_ONU_CHART" "$VOLTHA_ADAPTER_OPEN_ONU_CHART_VERSION" "+open-onu" "$_HELM_DESC OpenONU Adapter"
             INTERNAL_EXTRA_HELM_INSTALL_ARGS="$_ORIGINAL_EXTRA_HELM_INSTALL_ARGS"
         else
             espin - "$VERIFIED"
@@ -2244,9 +2247,9 @@
         ETCD_FLAG="-e $(get_service_ep "$INFRA_NS"  etcd)"
     fi
 fi
-CMD=("voltctl -a v3 $KAFKA_FLAG $SERVER_FLAG $ETCD_FLAG config")
+CMD=("voltctl $KAFKA_FLAG $SERVER_FLAG $ETCD_FLAG config")
 (set -x; ${CMD[*]} > "$HOME/.volt/config-$NAME" 2>>"$LOG") >>"$LOG" 2>&1
-#(set -x; voltctl -a v3 "$KAFKA_FLAG" "$SERVER_FLAG" "$ETCD_FLAG" config > "$HOME/.volt/config-$NAME" 2>>"$LOG") >>"$LOG" 2>&1
+#(set -x; voltctl "$KAFKA_FLAG" "$SERVER_FLAG" "$ETCD_FLAG" config > "$HOME/.volt/config-$NAME" 2>>"$LOG") >>"$LOG" 2>&1
 espin "$VERIFIED"
 
 if [ ! -f "$NAME-env.sh" ]; then