summaryrefslogtreecommitdiffstats
path: root/kubernetes/helm/plugins/ @media only all and (prefers-color-scheme: dark) { .highlight .hll { background-color: #49483e } .highlight .c { color: #75715e } /* Comment */ .highlight .err { color: #960050; background-color: #1e0010 } /* Error */ .highlight .k { color: #66d9ef } /* Keyword */ .highlight .l { color: #ae81ff } /* Literal */ .highlight .n { color: #f8f8f2 } /* Name */ .highlight .o { color: #f92672 } /* Operator */ .highlight .p { color: #f8f8f2 } /* Punctuation */ .highlight .ch { color: #75715e } /* Comment.Hashbang */ .highlight .cm { color: #75715e } /* Comment.Multiline */ .highlight .cp { color: #75715e } /* Comment.Preproc */ .highlight .cpf { color: #75715e } /* Comment.PreprocFile */ .highlight .c1 { color: #75715e } /* Comment.Single */ .highlight .cs { color: #75715e } /* Comment.Special */ .highlight .gd { color: #f92672 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gi { color: #a6e22e } /* Generic.Inserted */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #75715e } /* Generic.Subheading */ .highlight .kc { color: #66d9ef } /* Keyword.Constant */ .highlight .kd { color: #66d9ef } /* Keyword.Declaration */ .highlight .kn { color: #f92672 } /* Keyword.Namespace */ .highlight .kp { color: #66d9ef } /* Keyword.Pseudo */ .highlight .kr { color: #66d9ef } /* Keyword.Reserved */ .highlight .kt { color: #66d9ef } /* Keyword.Type */ .highlight .ld { color: #e6db74 } /* Literal.Date */ .highlight .m { color: #ae81ff } /* Literal.Number */ .highlight .s { color: #e6db74 } /* Literal.String */ .highlight .na { color: #a6e22e } /* Name.Attribute */ .highlight .nb { color: #f8f8f2 } /* Name.Builtin */ .highlight .nc { color: #a6e22e } /* Name.Class */ .highlight .no { color: #66d9ef } /* Name.Constant */ .highlight .nd { color: #a6e22e } /* Name.Decorator */ .highlight .ni { color: #f8f8f2 } /* Name.Entity */ .highlight .ne { color: #a6e22e } /* Name.Exception */ .highlight .nf { color: #a6e22e } /* Name.Function */ .highlight .nl { color: #f8f8f2 } /* Name.Label */ .highlight .nn { color: #f8f8f2 } /* Name.Namespace */ .highlight .nx { color: #a6e22e } /* Name.Other */ .highlight .py { color: #f8f8f2 } /* Name.Property */ .highlight .nt { color: #f92672 } /* Name.Tag */ .highlight .nv { color: #f8f8f2 } /* Name.Variable */ .highlight .ow { color: #f92672 } /* Operator.Word */ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
*** Settings ***
Documentation   Validate A&AI Serivce Instance

Resource          aai_interface.robot
Library    Collections
Library    ONAPLibrary.AAI    WITH NAME    AAI

*** Variables ***
${INDEX_PATH}     /aai/v11
${CUSTOMER_SPEC_PATH}    /business/customers/customer/
${SERVICE_SUBSCRIPTIONS}    /service-subscriptions/service-subscription/
${SERVICE_INSTANCE}    /service-instances?service-instance-name=

*** Keywords ***
Validate Volume Group
    [Arguments]    ${service_instance_name}    ${service_type}  ${customer_id}
  ${resp}=    AAI.Run Get Request      ${AAI_FRONTEND_ENDPOINT}    ${INDEX_PATH}${CUSTOMER_SPEC_PATH}${customer_id}${SERVICE_SUBSCRIPTIONS}${service_type}${SERVICE_INSTANCE}${service_instance_name}        auth=${GLOBAL_AAI_AUTHENTICATION}
    Dictionary Should Contain Value ${resp.json()['service-instance'][0]} 
#!/bin/bash

usage() {
cat << EOF
Install (or upgrade) an umbrella Helm Chart, and its subcharts, as separate Helm Releases

The umbrella Helm Chart is broken apart into a parent release and subchart releases.
Subcharts the are disabled (<chart>.enabled=false) will not be installed or upgraded.
All releases are grouped and deployed within the same namespace.


The deploy arguments must be a release and chart. The chart
argument can be either: a chart reference('stable/onap'), a path to a chart directory,
a packaged chart, or a fully qualified URL. For chart references, the latest
version will be specified unless the '--version' flag is set.

To override values in a chart, use either the '--values' flag and pass in a file
or use the '--set' flag and pass configuration from the command line, to force string
values, use '--set-string'.

You can specify the '--values'/'-f' flag multiple times. The priority will be given to the
last (right-most) file specified. For example, if both myvalues.yaml and override.yaml
contained a key called 'Test', the value set in override.yaml would take precedence:

    $ helm deploy demo ./onap --namespace onap -f openstack.yaml -f overrides.yaml

You can specify the '--set' flag multiple times. The priority will be given to the
last (right-most) set specified. For example, if both 'bar' and 'newbar' values are
set for a key called 'foo', the 'newbar' value would take precedence:

    $ helm deploy demo local/onap --namespace onap -f overrides.yaml --set log.enabled=false --set vid.enabled=false

Usage:
  helm deploy [RELEASE] [CHART] [flags]

Flags:
      --namespace string         namespace to install the release into. Defaults to the current kube config namespace.
      --set stringArray          set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
      --set-string stringArray   set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
  -f, --values valueFiles        specify values in a YAML file or a URL(can specify multiple) (default [])
      --verbose                  enables full helm install/upgrade output during deploy
      --set-last-applied         set the last-applied-configuration annotation on all objects.This annotation is required to restore services using Ark/Veloro backup restore.
EOF
}

generate_overrides() {
  SUBCHART_NAMES=($(cat $COMPUTED_OVERRIDES | grep -v '^\s\s'))

  for index in "${!SUBCHART_NAMES[@]}"; do
    START=${SUBCHART_NAMES[index]}
    END=${SUBCHART_NAMES[index+1]}
    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
    else
      SUBCHART_DIR="$CACHE_SUBCHART_DIR/$(echo "$START" |cut -d':' -f1)"
      if [ -d "$SUBCHART_DIR" ]; then
        if [ -z "$END" ]; then
          cat $COMPUTED_OVERRIDES | sed -n '/^'"$START"'/,/'"$END"'/p' \
            | sed '1d;$d' | cut -c3- > $SUBCHART_DIR/subchart-overrides.yaml
        else
          cat $COMPUTED_OVERRIDES | sed -n '/^'"$START"'/,/^'"$END"'/p' \
            | sed '1d;$d' | cut -c3- > $SUBCHART_DIR/subchart-overrides.yaml
        fi
      fi
    fi
  done
}


resolve_deploy_flags() {
  flags=($1)
  n=${#flags[*]}
  i=0 ; while [ "$i" -lt "$n" ]; do
    PARAM=${flags[i]}
    if [ "$PARAM" = "-f" ] || \
       [ "$PARAM" = "--values" ] || \
       [ "$PARAM" = "--set" ] || \
       [ "$PARAM" = "--set-string" ] || \
       [ "$PARAM" = "--version" ]; then
       # skip param and its value
       i=$((i + 1))
    else
      DEPLOY_FLAGS="$DEPLOY_FLAGS $PARAM"
    fi
    i=$((i+1))
  done
  echo "$DEPLOY_FLAGS"
}


check_for_dep() {
    try=0
    retries=60
    until (kubectl get deployment -n $HELM_NAMESPACE | grep -P "\b$1\b") &>/dev/null; do
        (( ++try > retries )) && exit 1
        echo "$1 not found. Retry $try/$retries"
        sleep 10
    done
    echo "$1 found. Waiting for pod intialisation"
    sleep 15
}

deploy_strimzi() {
  #Deploy the srtimzi-kafka chart in advance. Dependent charts require the entity-operator
  #for management of the strimzi crds
  deploy_subchart
  echo "waiting for ${RELEASE}-strimzi-entity-operator to be deployed"
  check_for_dep ${RELEASE}-strimzi-entity-operator
}

deploy_subchart() {
  if [ -z "$SUBCHART_RELEASE" ] || [ "$SUBCHART_RELEASE" = "$subchart" ]; then
        LOG_FILE=$LOG_DIR/"${RELEASE}-${subchart}".log
        :> $LOG_FILE

        helm upgrade -i "${RELEASE}-${subchart}" $CACHE_SUBCHART_DIR/$subchart \
         $DEPLOY_FLAGS -f $GLOBAL_OVERRIDES -f $SUBCHART_OVERRIDES \
         > $LOG_FILE 2>&1

        if [ "$VERBOSE" = "true" ]; then
          cat $LOG_FILE
        else
          echo "release \"${RELEASE}-${subchart}\" deployed"
        fi
        # Add annotation last-applied-configuration if set-last-applied flag is set
        if [ "$SET_LAST_APPLIED" = "true" ]; then
          helm get manifest "${RELEASE}-${subchart}" \
          | kubectl apply set-last-applied --create-annotation -n $HELM_NAMESPACE -f - \
          > $LOG_FILE.log 2>&1
        fi
      fi
      if [ "$DELAY" = "true" ]; then
        echo sleep 3m
        sleep 180
      fi
}

deploy() {
  # validate params
  if [ -z "$1" ] || [ -z "$2" ]; then
    usage
    exit 1
  fi

  RELEASE=$1
  CHART_URL=$2
  FLAGS=$(echo ${@} | sed 's/^ *[^ ]* *[^ ]* *//')
  CHART_REPO="$(echo "$CHART_URL" | cut -d'/' -f1)"
  CHART_NAME="$(echo "$CHART_URL" | cut -d'/' -f2)"

  CACHE_DIR=~/.local/share/helm/plugins/deploy/cache
  echo "Use cache dir: $CACHE_DIR"
  CHART_DIR=$CACHE_DIR/$CHART_NAME
  CACHE_SUBCHART_DIR=$CHART_DIR-subcharts
  LOG_DIR=$CHART_DIR/logs

  # determine if verbose output is enabled
  VERBOSE="false"
  if expr "$FLAGS" : ".*--verbose.*" ; then
    FLAGS="$(echo $FLAGS| sed -n 's/--verbose//p')"
    VERBOSE="true"
  fi
  # determine if delay for deployment is enabled
  DELAY="false"
  if expr "$FLAGS" : ".*--delay.*" ; then
    FLAGS="$(echo $FLAGS| sed -n 's/--delay//p')"
    DELAY="true"
  fi
  # determine if set-last-applied flag is enabled
  SET_LAST_APPLIED="false"
  if expr "$FLAGS" : ".*--set-last-applied.*" ; then
    FLAGS="$(echo $FLAGS| sed -n 's/--set-last-applied//p')"
    SET_LAST_APPLIED="true"
  fi
  if expr "$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)"

  VERSION="$(echo $FLAGS | sed -n 's/.*\(version\).\s*/\1/p' | cut -c8- | cut -d' ' -f1)"

  if [ ! -z $VERSION ]; then
     VERSION="--version $VERSION"
  fi

  # Remove all override values passed in as arguments. These will be used during dry run
  # to resolve computed override values. Remaining flags will be passed on during
  # actual upgrade/install of parent and subcharts.
  DEPLOY_FLAGS=$(resolve_deploy_flags "$FLAGS")

  # determine if upgrading individual subchart or entire parent + subcharts
  SUBCHART_RELEASE="$(echo "$RELEASE" |cut -d'-' -f2)"
  # update specified subchart without parent
  RELEASE="$(echo "$RELEASE" |cut -d'-' -f1)"
  if [ "$SUBCHART_RELEASE" = "$RELEASE" ]; then
    SUBCHART_RELEASE=
  fi

  # clear previously cached charts
  rm -rf $CACHE_DIR

  # fetch umbrella chart (parent chart containing subcharts)
  if [ -d "$CHART_URL" ]; then
    mkdir -p $CHART_DIR
    cp -R $CHART_URL/* $CHART_DIR/

    charts=$CHART_DIR/charts/*
    for subchart in $charts ; do
      tar xzf ${subchart} -C $CHART_DIR/charts/
    done
    rm -rf $CHART_DIR/charts/*.tgz
  else
    echo "fetching $CHART_URL"
    helm fetch $CHART_URL --untar --untardir $CACHE_DIR $VERSION
  fi

  # create log driectory
  mkdir -p $LOG_DIR

  # move out subcharts to process separately
  mkdir -p $CACHE_SUBCHART_DIR
  mv $CHART_DIR/charts/* $CACHE_SUBCHART_DIR/
  # temp hack - parent chart needs common subchart
  mv $CACHE_SUBCHART_DIR/common $CHART_DIR/charts/

 # disable dependencies
  rm $CHART_DIR/Chart.lock
  sed -n '1,/dependencies:/p;/description:/,$p' $CHART_DIR/Chart.yaml | grep -v dependencies > $CHART_DIR/deploy_Chart.yaml
  mv $CHART_DIR/Chart.yaml $CHART_DIR/Chart.deploy
  mv $CHART_DIR/deploy_Chart.yaml $CHART_DIR/Chart.yaml

  # compute overrides for parent and all subcharts
  COMPUTED_OVERRIDES=$CACHE_DIR/$CHART_NAME/computed-overrides.yaml
  helm upgrade -i $RELEASE $CHART_DIR $FLAGS --dry-run --debug \
   | sed -n '/COMPUTED VALUES:/,/HOOKS:/p' | sed '1d;$d' > $COMPUTED_OVERRIDES

  # extract global overrides to apply to parent and all subcharts
  GLOBAL_OVERRIDES=$CHART_DIR/global-overrides.yaml
  generate_overrides $COMPUTED_OVERRIDES $GLOBAL_OVERRIDES

  # upgrade/install parent chart first
  if [ -z "$SUBCHART_RELEASE" ]; then
    LOG_FILE=$LOG_DIR/${RELEASE}.log
    :> $LOG_FILE

    helm upgrade -i $RELEASE $CHART_DIR $DEPLOY_FLAGS -f $COMPUTED_OVERRIDES \
     > $LOG_FILE.log 2>&1

    if [ "$VERBOSE" = "true" ]; then
      cat $LOG_FILE
    else
      echo "release \"$RELEASE\" deployed"
    fi
    # Add annotation last-applied-configuration if set-last-applied flag is set
    if [ "$SET_LAST_APPLIED" = "true" ]; then
      helm get manifest ${RELEASE} \
      | kubectl apply set-last-applied --create-annotation -n $HELM_NAMESPACE -f - \
      > $LOG_FILE.log 2>&1
    fi
  fi

  # upgrade/install each "enabled" subchart
  cd $CACHE_SUBCHART_DIR/
  #“helm ls” is an expensive command in that it can take a long time to execute.
  #So cache the results to prevent repeated execution.
  ALL_HELM_RELEASES=$(helm ls -q)

    for subchart in strimzi cassandra mariadb-galera postgres ; do
      SUBCHART_OVERRIDES=$CACHE_SUBCHART_DIR/$subchart/subchart-overrides.yaml

      SUBCHART_ENABLED=0
      if [ -f $SUBCHART_OVERRIDES ]; then
        SUBCHART_ENABLED=$(cat $SUBCHART_OVERRIDES | grep -c "^enabled: true")
      fi
      if [ "${subchart}" = "strimzi" ] && [ $SUBCHART_ENABLED -eq 1 ]; then
        deploy_strimzi
      fi
      # Deploy them at first
      if [ $SUBCHART_ENABLED -eq 1 ]; then
        deploy_subchart
      else
        array=($(echo "$ALL_HELM_RELEASES" | grep "${RELEASE}-${subchart}"))
        n=${#array[*]}
        for i in $(seq $(($n-1)) -1 0); do
          helm del "${array[i]}"
        done
      fi
    done

    for subchart in * ; do
      SUBCHART_OVERRIDES=$CACHE_SUBCHART_DIR/$subchart/subchart-overrides.yaml

      SUBCHART_ENABLED=0
      if [ -f $SUBCHART_OVERRIDES ]; then
        SUBCHART_ENABLED=$(cat $SUBCHART_OVERRIDES | grep -c "^enabled: true")
      fi
      if [ "${subchart}" = "strimzi" ] || [ "${subchart}" = "cassandra" ] || [ "${subchart}" = "mariadb-galera" ] || [ "${subchart}" = "postgres" ]; then
        SUBCHART_ENABLED=0
      fi
      # Deploy the others
      if [ $SUBCHART_ENABLED -eq 1 ]; then
        deploy_subchart
      else
        array=($(echo "$ALL_HELM_RELEASES" | grep "${RELEASE}-${subchart}"))
        n=${#array[*]}
        for i in $(seq $(($n-1)) -1 0); do
          helm del "${array[i]}"
        done
      fi
    done

  # report on success/failures of installs/upgrades
  helm ls --all-namespaces | grep -i FAILED | grep $RELEASE
}
HELM_VER=$(helm version --template "{{.Version}}")
echo $HELM_VER

case "${1:-"help"}" in
  "help")
    usage
    ;;
  "--help")
    usage
    ;;
  "-h")
    usage
    ;;
  *)
    deploy $1 $2 $(echo ${@} | sed 's/^ *[^ ]* *[^ ]* *//')
    ;;
esac

exit 0