diff options
-rwxr-xr-x | kubernetes/helm/plugins/deploy/deploy.sh | 168 | ||||
-rw-r--r-- | kubernetes/helm/plugins/deploy/plugin.yaml | 7 | ||||
-rw-r--r-- | kubernetes/helm/plugins/undeploy/plugin.yaml | 7 | ||||
-rwxr-xr-x | kubernetes/helm/plugins/undeploy/undeploy.sh | 52 | ||||
-rw-r--r-- | kubernetes/log/Chart.yaml | 2 | ||||
-rw-r--r-- | kubernetes/log/charts/log-elasticsearch/Chart.yaml | 2 | ||||
-rw-r--r-- | kubernetes/log/charts/log-kibana/Chart.yaml | 2 | ||||
-rw-r--r-- | kubernetes/log/charts/log-logstash/Chart.yaml | 2 | ||||
-rw-r--r-- | kubernetes/multicloud/charts/multicloud-ocata/templates/configmap.yaml | 5 | ||||
-rw-r--r-- | kubernetes/multicloud/charts/multicloud-vio/templates/configmap.yaml | 5 | ||||
-rw-r--r-- | kubernetes/multicloud/charts/multicloud-windriver/templates/configmap.yaml | 5 | ||||
-rw-r--r-- | kubernetes/multicloud/templates/configmap.yaml | 15 | ||||
-rw-r--r-- | kubernetes/onap/requirements.yaml | 6 | ||||
-rw-r--r-- | kubernetes/onap/values.yaml | 2 | ||||
-rwxr-xr-x | kubernetes/robot/demo-k8s.sh | 4 | ||||
-rwxr-xr-x | kubernetes/robot/ete-k8s.sh | 3 |
16 files changed, 280 insertions, 7 deletions
diff --git a/kubernetes/helm/plugins/deploy/deploy.sh b/kubernetes/helm/plugins/deploy/deploy.sh new file mode 100755 index 0000000000..07455d7db4 --- /dev/null +++ b/kubernetes/helm/plugins/deploy/deploy.sh @@ -0,0 +1,168 @@ +#!/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 []) +EOF +} + +parse_yaml() { + local prefix=$2 + local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') + sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ + -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | + awk -F$fs '{ + indent = length($1)/2; + vname[indent] = $2; + for (i in vname) {if (i > indent) {delete vname[i]}} + if (length($3) > 0) { + vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")} + printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3); + } + }' +} + +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/$(cut -d':' -f1 <<<"$START")" + if [[ -d "$SUBCHART_DIR" ]]; then + cat $COMPUTED_OVERRIDES | sed -n '/'"$START"'/,/'"$END"'/p' \ + | sed '1d;$d' | cut -c3- > $SUBCHART_DIR/subchart-overrides.yaml + fi + fi + done +} + +deploy() { + RELEASE=$1 + CHART_URL=$2 + FLAGS=${@:3} + CHART_REPO="$(cut -d'/' -f1 <<<"$CHART_URL")" + CHART_NAME="$(cut -d'/' -f2 <<<"$CHART_URL")" + CACHE_DIR=~/.helm/plugins/deploy/cache + CHART_DIR=$CACHE_DIR/$CHART_NAME + CACHE_SUBCHART_DIR=$CHART_DIR-subcharts + # should pass all flags instead + NAMESPACE="$(echo $FLAGS | sed -n 's/.*\(namespace\).\s*/\1/p' | cut -c10-)" + + # 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/ + + cd $CHART_DIR/charts/ + for subchart in * ; do + tar xzf ${subchart} + done + rm -rf *.tgz + else + helm fetch $CHART_URL --untar --untardir $CACHE_DIR + fi + + # 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/requirements.lock + mv $CHART_DIR/requirements.yaml $CHART_DIR/requirements.deploy + + # 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 + helm upgrade -i $RELEASE $CHART_DIR --namespace $NAMESPACE -f $COMPUTED_OVERRIDES + + # parse computed overrides - will use to determine if a subchart is "enabled" + eval $(parse_yaml $COMPUTED_OVERRIDES "computed_") + + # upgrade/install each "enabled" subchart + cd $CACHE_SUBCHART_DIR + for subchart in * ; do + VAR="computed_${subchart}_enabled" + COMMAND="$"$VAR + eval "SUBCHART_ENABLED=$COMMAND" + if [[ $SUBCHART_ENABLED == "true" ]]; then + SUBCHART_OVERRIDES=$CACHE_SUBCHART_DIR/$subchart/subchart-overrides.yaml + helm upgrade -i "${RELEASE}-${subchart}" $CACHE_SUBCHART_DIR/$subchart \ + --namespace $NAMESPACE -f $GLOBAL_OVERRIDES -f $SUBCHART_OVERRIDES + fi + done +} + +if [[ $# < 2 ]]; then + usage + exit 0 +fi + +case "${1:-"help"}" in + "help") + usage + ;; + "--help") + usage + ;; + "-h") + usage + ;; + *) + deploy $1 $2 ${@:3} + ;; +esac + +exit 0
\ No newline at end of file diff --git a/kubernetes/helm/plugins/deploy/plugin.yaml b/kubernetes/helm/plugins/deploy/plugin.yaml new file mode 100644 index 0000000000..fc7f7d0f88 --- /dev/null +++ b/kubernetes/helm/plugins/deploy/plugin.yaml @@ -0,0 +1,7 @@ +name: "deploy" +version: "1.0.0" +usage: "install (upgrade if release exists) parent chart and subcharts as separate +but related releases" +description: "install (upgrade if release exists) parent charty and all subcharts as separate +but related releases" +command: "$HELM_PLUGIN_DIR/deploy.sh"
\ No newline at end of file diff --git a/kubernetes/helm/plugins/undeploy/plugin.yaml b/kubernetes/helm/plugins/undeploy/plugin.yaml new file mode 100644 index 0000000000..02999fd04c --- /dev/null +++ b/kubernetes/helm/plugins/undeploy/plugin.yaml @@ -0,0 +1,7 @@ +name: "undeploy" +version: "1.0.0" +usage: "delete parent chart and subcharts that were deployed as separate +releases" +description: "delete parent chart and subcharts that were deployed as separate +releases" +command: "$HELM_PLUGIN_DIR/undeploy.sh"
\ No newline at end of file diff --git a/kubernetes/helm/plugins/undeploy/undeploy.sh b/kubernetes/helm/plugins/undeploy/undeploy.sh new file mode 100755 index 0000000000..02b5d34c65 --- /dev/null +++ b/kubernetes/helm/plugins/undeploy/undeploy.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +usage() { +cat << EOF +Delete an umbrella Helm Chart, and its subcharts, that was previously deployed using 'Helm deploy'. + +Example of deleting all Releases that have the prefix 'demo'. + $ helm undeploy demo + + $ helm undeploy demo --purge + +Usage: + helm undeploy [RELEASE] [flags] + +Flags: + --purge remove the releases from the store and make its name free for later use +EOF +} + +undeploy() { + RELEASE=$1 + FLAGS=$2 + + array=($(helm ls -q | grep $RELEASE)) + n=${#array[*]} + for (( i = n-1; i >= 0; i-- )) + do + helm del "${array[i]}" $FLAGS + done +} + +if [[ $# < 1 ]]; then + echo "Error: command 'undeploy' requires a release name" + exit 0 +fi + +case "${1:-"help"}" in + "help") + usage + ;; + "--help") + usage + ;; + "-h") + usage + ;; + *) + undeploy $1 ${@:2} + ;; +esac + +exit 0
\ No newline at end of file diff --git a/kubernetes/log/Chart.yaml b/kubernetes/log/Chart.yaml index 6bbd5b90db..9dbdad51e7 100644 --- a/kubernetes/log/Chart.yaml +++ b/kubernetes/log/Chart.yaml @@ -16,4 +16,4 @@ apiVersion: v1 description: ONAP Logging ElasticStack name: log -version: 2.0.0 +version: 3.0.0 diff --git a/kubernetes/log/charts/log-elasticsearch/Chart.yaml b/kubernetes/log/charts/log-elasticsearch/Chart.yaml index 2be8c79641..88edfd089a 100644 --- a/kubernetes/log/charts/log-elasticsearch/Chart.yaml +++ b/kubernetes/log/charts/log-elasticsearch/Chart.yaml @@ -16,4 +16,4 @@ apiVersion: v1 description: ONAP Logging Elasticsearch name: log-elasticsearch -version: 2.0.0 +version: 3.0.0 diff --git a/kubernetes/log/charts/log-kibana/Chart.yaml b/kubernetes/log/charts/log-kibana/Chart.yaml index 7fe685104f..14a4eb7ac3 100644 --- a/kubernetes/log/charts/log-kibana/Chart.yaml +++ b/kubernetes/log/charts/log-kibana/Chart.yaml @@ -16,4 +16,4 @@ apiVersion: v1 description: ONAP Logging Kibana name: log-kibana -version: 2.0.0 +version: 3.0.0 diff --git a/kubernetes/log/charts/log-logstash/Chart.yaml b/kubernetes/log/charts/log-logstash/Chart.yaml index 62bafab9ba..99f93b404d 100644 --- a/kubernetes/log/charts/log-logstash/Chart.yaml +++ b/kubernetes/log/charts/log-logstash/Chart.yaml @@ -16,4 +16,4 @@ apiVersion: v1 description: ONAP Logging Logstash name: log-logstash -version: 2.0.0 +version: 3.0.0 diff --git a/kubernetes/multicloud/charts/multicloud-ocata/templates/configmap.yaml b/kubernetes/multicloud/charts/multicloud-ocata/templates/configmap.yaml index 16355ee513..7dd8fa5bd0 100644 --- a/kubernetes/multicloud/charts/multicloud-ocata/templates/configmap.yaml +++ b/kubernetes/multicloud/charts/multicloud-ocata/templates/configmap.yaml @@ -20,5 +20,10 @@ kind: ConfigMap metadata: name: {{ include "common.fullname" . }}-log-configmap namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/log/*").AsConfig . | indent 2 }} diff --git a/kubernetes/multicloud/charts/multicloud-vio/templates/configmap.yaml b/kubernetes/multicloud/charts/multicloud-vio/templates/configmap.yaml index 411c445695..0b39a5c93e 100644 --- a/kubernetes/multicloud/charts/multicloud-vio/templates/configmap.yaml +++ b/kubernetes/multicloud/charts/multicloud-vio/templates/configmap.yaml @@ -20,5 +20,10 @@ kind: ConfigMap metadata: name: {{ include "common.fullname" . }}-log-configmap namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/log/*").AsConfig . | indent 2 }} diff --git a/kubernetes/multicloud/charts/multicloud-windriver/templates/configmap.yaml b/kubernetes/multicloud/charts/multicloud-windriver/templates/configmap.yaml index 411c445695..0b39a5c93e 100644 --- a/kubernetes/multicloud/charts/multicloud-windriver/templates/configmap.yaml +++ b/kubernetes/multicloud/charts/multicloud-windriver/templates/configmap.yaml @@ -20,5 +20,10 @@ kind: ConfigMap metadata: name: {{ include "common.fullname" . }}-log-configmap namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/log/*").AsConfig . | indent 2 }} diff --git a/kubernetes/multicloud/templates/configmap.yaml b/kubernetes/multicloud/templates/configmap.yaml index bdbbc9b776..e2b789d5dd 100644 --- a/kubernetes/multicloud/templates/configmap.yaml +++ b/kubernetes/multicloud/templates/configmap.yaml @@ -20,6 +20,11 @@ kind: ConfigMap metadata: name: multicloud-filebeat-configmap namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/log/filebeat/*").AsConfig . | indent 2 }} --- @@ -28,6 +33,11 @@ kind: ConfigMap metadata: name: {{ include "common.fullname" . }}-log-configmap namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/log/framework/*").AsConfig . | indent 2 }} --- @@ -36,5 +46,10 @@ kind: ConfigMap metadata: name: {{ include "common.fullname" . }}-provider-plugin-configmap namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/provider-plugin.json").AsConfig . | indent 2 }} diff --git a/kubernetes/onap/requirements.yaml b/kubernetes/onap/requirements.yaml index 911a1d55f9..b6e450a65e 100644 --- a/kubernetes/onap/requirements.yaml +++ b/kubernetes/onap/requirements.yaml @@ -44,6 +44,10 @@ dependencies: version: ~2.0.0 repository: '@local' condition: consul.enabled + - name: contrib + version: ~2.0.0 + repository: '@local' + condition: contrib.enabled - name: dcaegen2 version: ~2.0.0 repository: '@local' @@ -57,7 +61,7 @@ dependencies: repository: '@local' condition: esr.enabled - name: log - version: ~2.0.0 + version: ~3.0.0 repository: '@local' condition: log.enabled - name: sniro-emulator diff --git a/kubernetes/onap/values.yaml b/kubernetes/onap/values.yaml index 4d3707033f..9b56c7ba11 100644 --- a/kubernetes/onap/values.yaml +++ b/kubernetes/onap/values.yaml @@ -78,6 +78,8 @@ cli: enabled: true consul: enabled: true +contrib: + enabled: true dcaegen2: enabled: true dmaap: diff --git a/kubernetes/robot/demo-k8s.sh b/kubernetes/robot/demo-k8s.sh index 5e8ba3331b..c4124c2ad4 100755 --- a/kubernetes/robot/demo-k8s.sh +++ b/kubernetes/robot/demo-k8s.sh @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash -x +#!/bin/bash # # Execute tags built to support the hands on demo, @@ -166,6 +166,8 @@ do esac done +set -x + ETEHOME=/var/opt/OpenECOMP_ETE VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py" POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot) diff --git a/kubernetes/robot/ete-k8s.sh b/kubernetes/robot/ete-k8s.sh index befe142311..22b83e8545 100755 --- a/kubernetes/robot/ete-k8s.sh +++ b/kubernetes/robot/ete-k8s.sh @@ -20,10 +20,11 @@ # Note: Do not run multiple concurrent ete.sh as the --display is not parameterized and tests will collide # if [ "$1" == "" ] || [ "$2" == "" ]; then - echo "Usage: ete-k8s.sh [namespace] [ health | ete | closedloop | instantiate | distribute ]" + echo "Usage: ete-k8s.sh [namespace] [ health | ete | closedloop | instantiate | distribute | portal ]" exit fi +set -x export NAMESPACE="$1" |