diff options
Diffstat (limited to 'kubernetes')
-rw-r--r-- | kubernetes/Makefile | 32 | ||||
-rw-r--r-- | kubernetes/README.md | 133 | ||||
-rw-r--r-- | kubernetes/README_HELM | 20 | ||||
-rw-r--r-- | kubernetes/common/Makefile | 2 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/.helmignore (renamed from kubernetes/dgbuilder/.helmignore) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/Chart.yaml (renamed from kubernetes/dgbuilder/Chart.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/requirements.yaml (renamed from kubernetes/dgbuilder/requirements.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/resources/config/svclogic.properties (renamed from kubernetes/dgbuilder/resources/config/svclogic.properties) | 0 | ||||
-rwxr-xr-x | kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh (renamed from kubernetes/dgbuilder/resources/scripts/createReleaseDir.sh) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/resources/scripts/customSettings.js (renamed from kubernetes/dgbuilder/resources/scripts/customSettings.js) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/templates/NOTES.txt (renamed from kubernetes/dgbuilder/templates/NOTES.txt) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/templates/configmap.yaml (renamed from kubernetes/dgbuilder/templates/configmap.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/templates/deployment.yaml (renamed from kubernetes/dgbuilder/templates/deployment.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/templates/secrets.yaml (renamed from kubernetes/dgbuilder/templates/secrets.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/templates/service.yaml (renamed from kubernetes/dgbuilder/templates/service.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/dgbuilder/values.yaml (renamed from kubernetes/dgbuilder/values.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/.helmignore (renamed from kubernetes/mysql/.helmignore) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/Chart.yaml (renamed from kubernetes/mysql/Chart.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/requirements.yaml (renamed from kubernetes/mysql/requirements.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/templates/configmap.yaml (renamed from kubernetes/mysql/templates/configmap.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/templates/nfs-provisoner.yaml (renamed from kubernetes/mysql/templates/nfs-provisoner.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/templates/pv.yaml (renamed from kubernetes/mysql/templates/pv.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/templates/pvc.yaml (renamed from kubernetes/mysql/templates/pvc.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/templates/secrets.yaml (renamed from kubernetes/mysql/templates/secrets.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/templates/service.yaml (renamed from kubernetes/mysql/templates/service.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/templates/statefulset.yaml (renamed from kubernetes/mysql/templates/statefulset.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/templates/storageclass.yaml (renamed from kubernetes/mysql/templates/storageclass.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/common/mysql/values.yaml (renamed from kubernetes/mysql/values.yaml) | 0 | ||||
-rw-r--r-- | kubernetes/multicloud/templates/multicloud-windriver-deployment.yaml | 2 | ||||
-rwxr-xr-x | kubernetes/oneclick/createAll.bash | 189 | ||||
-rwxr-xr-x | kubernetes/oneclick/deleteAll.bash | 150 | ||||
-rw-r--r-- | kubernetes/oneclick/setenv.bash | 15 | ||||
-rw-r--r-- | kubernetes/oneclick/tools/autoCleanConfig.bash | 54 | ||||
-rw-r--r-- | kubernetes/oneclick/tools/autoCreateConfig.bash | 65 | ||||
-rw-r--r-- | kubernetes/oneclick/tools/collectInfo.bash | 171 |
35 files changed, 96 insertions, 737 deletions
diff --git a/kubernetes/Makefile b/kubernetes/Makefile index 9cbf90fba7..7ba5ba934a 100644 --- a/kubernetes/Makefile +++ b/kubernetes/Makefile @@ -1,26 +1,33 @@ +# Copyright © 2017 Amdocs, Bell Canada +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + PARENT_CHART := onap COMMON_CHARTS_DIR := common -SETUP_CHARTS_DIR := setup -#Order is important -SHARED_CHARTS := common setup mysql dgbuilder # FIXME OOM-765 ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) OUTPUT_DIR := $(ROOT_DIR)/dist PACKAGE_DIR := $(OUTPUT_DIR)/packages SECRET_DIR := $(OUTPUT_DIR)/secrets -EXCLUDES := $(COMMON_CHARTS_DIR) config oneclick readiness test dist helm $(PARENT_CHART) dcae -EXCLUDES := $(SHARED_CHARTS) config oneclick readiness test dist $(PARENT_CHART) dcae +EXCLUDES := config oneclick readiness test dist helm $(PARENT_CHART) dcae HELM_CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) $(PARENT_CHART) .PHONY: $(EXCLUDES) $(HELM_CHARTS) all: $(COMMON_CHARTS_DIR) $(HELM_CHARTS) -common: -all: $(SHARED_CHARTS) $(HELM_CHARTS) - -$(SHARED_CHARTS): +$(COMMON_CHARTS): @echo "\n[$@]" @make package-$@ @@ -45,5 +52,12 @@ clean: @rm -f */requirements.lock @rm -f *tgz */charts/*tgz @rm -rf $(PACKAGE_DIR) + +# start up a local helm repo to serve up +repo: + @mkdir -p $(PACKAGE_DIR) + @helm serve --repo-path $(PACKAGE_DIR) & + @helm repo index $(PACKAGE_DIR) + @helm repo add local http://127.0.0.1:8879 %: @: diff --git a/kubernetes/README.md b/kubernetes/README.md index dc49e5445b..9c315cbafe 100644 --- a/kubernetes/README.md +++ b/kubernetes/README.md @@ -1,78 +1,87 @@ -## **Quick Start Guide - ONAP on Kubernetes** +## **Quick Start Guide** -This is a quick start guide to help you get started on ONAP installation. Creating an ONAP deployment instance requires creating base configuration on the host node and then deploying the runtime containers. +This is a quick start guide describing how to deploy ONAP on Kubernetes using Helm. Pre-requisites: - Your Kubernetes environment must be available. For more information see, [ONAP on Kubernetes](https://wiki.onap.org/display/DW/ONAP+on+Kubernetes). - Deployment artifacts are customized for your location. -Step 1 -Review and optionally change configuration parameters: - -Setup the [/oom/kubernetes/config/onap-parameters.yaml](https://gerrit.onap.org/r/gitweb?p=oom.git;a=blob;f=kubernetes/config/onap-parameters.yaml;h=7ddaf4d4c3dccf2fad515265f0da9c31ec0e64b1;hb=refs/heads/master) file with key-value pairs specific to your OpenStack environment. - -OR - -There is a [sample](https://gerrit.onap.org/r/gitweb?p=oom.git;a=blob;f=kubernetes/config/onap-parameters-sample.yaml;h=3a74beddbbf7f9f9ec8e5a6abaecb7cb238bd519;hb=refs/heads/master) that may help you out or even be usable directly if you don't intend to actually use OpenStack resources. - - -Step 2 - -In-order to be able to support multiple ONAP instances within a single kubernetes environment, a configuration set is required. To do this, execute the [createConfig.sh](https://gerrit.onap.org/r/gitweb?p=oom.git;a=blob;f=kubernetes/config/createConfig.sh;h=f226ccae47ca6de15c1da49be4b8b6de974895ed;hb=refs/heads/master) script: - -> oom/kubernetes/config/createConfig.sh -n onap - -Where: -'onap' refers to the name of the instance. This serves as the Namespace prefix for each deployed ONAP component (for example, onap-mso). - -Step 3 - -The bash script [createAll.bash](https://gerrit.onap.org/r/gitweb?p=oom.git;a=blob;f=kubernetes/oneclick/createAll.bash;h=5e5f2dc76ea7739452e757282e750638b4e3e1de;hb=refs/heads/master) is used to create an ONAP deployment with kubernetes. It has two primary functions: - -- Creating the namespaces used to encapsulate the ONAP components, and -- Creating the services, pods and containers within each of these namespaces that provide the core functionality of ONAP. - -Before you execute the createAll.bash. script, pod config-init ([pod-config-init.yaml](https://gerrit.onap.org/r/gitweb?p=oom.git;a=blob;f=kubernetes/config/pod-config-init.yaml;h=b1285ce21d61815c082f6d6aa3c43d00561811c7;hb=refs/heads/master)) may need editing to match your environment and deployment into the default namespace. - -To deploy the containers and create your ONAP system, execute the following command: - -> oom/kubernetes/oneclick/createAll.bash -n onap - -#### **Additional information on usage of createAll.bash** - -Namespaces provide isolation between ONAP components as ONAP release 1.0 contains duplicate application (for example, mariadb) and port usage. - -As such createAll.bash requires the user to enter a namespace prefix string that can be used to separate multiple deployments of onap. The result will be set of 10 namespaces (for example, onap-sdc, onap-aai, onap-mso, onap-message-router, onap-robot, onap-vid, onap-sdnc, onap-portal, onap-policy, onap-appc) being created within the kubernetes environment. - - -#### **Deploying multiple ONAP instances within the same Kubernetes cluster** - -To deploy multiple ONAP instances, you must specify the number of Instances you would like to create in a Kubernetes cluster using createAllbash. - -This is currently required due to the use of NodePort ranges. NodePorts allow external IP:Port access to containers that are running inside a Kubernetes cluster. - -To create multiple instances of an ONAP deployment in the cluster, use the following commands: - -> oom/kubernetes/config/createConfig.sh -n onap - -> oom/kubernetes/oneclick/createAll.bash -n onap -i 2 - -Where: - -- 'onap' refers to the name of the instance. - -- ‘i 2’ refers to the number of instances of an ONAP deployment in the cluster. - -#### **To delete a deployed instance** +### **Deploy ONAP Instance** + +Step 1. Clone the OOM repository from ONAP gerrit: + +``` +> git clone http://gerrit.onap.org/r/oom +> cd oom/kubernetes +``` + +Step 2. Customize the oom/kubernetes/onap parent chart, like the values.yaml file, to suit your deployment. You may want to selectively enable or disable ONAP components by changing the subchart **enabled** flags to *true* or *false*. +``` +Example: +... +robot: # Robot Health Check + enabled: true +sdc: + enabled: false +sdnc: + enabled: false +so: # Service Orchestrator + enabled: true +... +``` + +Step 3. To setup a local Helm repository to serve up the local ONAP charts: +``` +> helm serve & +``` +Note the port number that is listed and use it in the Helm repo add as follows: +``` +> helm repo add local http://127.0.0.1:8879 +``` + +Step 4. Build a local Helm repository (from the kubernetes directory): +``` +> make all +``` + +Step 5. Display the charts that are available to be deployed: +``` +> helm search -l +NAME VERSION DESCRIPTION +local/appc 2.0.0 Application Controller +local/clamp 2.0.0 ONAP Clamp +local/onap 2.0.0 Open Network Automation Platform (ONAP) +local/robot 2.0.0 A helm Chart for kubernetes-ONAP Robot +local/so 2.0.0 ONAP Service Orchestrator +... +``` + +**Note:** +Setup of this Helm repository is a one time activity. If you make changes to your deployment charts or values be sure to use **make** to update your local Helm repository. + +Step 6. Once the repo is setup, installation of ONAP can be done with a single command: +``` +> helm install local/onap -name dev --namespace onap +``` +**Note:** the **--namespace onap** is currently required while all onap helm charts are migrated to version 2.0. After this activity is complete, namespaces will be optional. + +Use the following to monitor your deployment and determine when ONAP is ready for use: +``` +> kubectl get pods --all-namespaces -o=wide +``` + + +#### **Cleanup deployed ONAP instance** To delete a deployed instance, use the following command: +``` +> helm del dev --purge +``` -> oom/kubernetes/oneclick/deleteAll.bash -n onap -**Note:** Deleting the runtime containers does not remove the configuration created in step 2. For more information on OOM project documentation, refer to: diff --git a/kubernetes/README_HELM b/kubernetes/README_HELM deleted file mode 100644 index 0f65120397..0000000000 --- a/kubernetes/README_HELM +++ /dev/null @@ -1,20 +0,0 @@ -Prerequisites: -- K8s -- Helm - -In order to use Helm with Rancher, check the tiller version installed -by running "helm version" on the rancher CLI -and install the appropriate Helm. -Notice both tiller and helm are installed, -but you will need to install on your VM. - -charts were tested with the following setup: - Rancher Release v1.6.7 - k8s version 1.7.2 - Helm/Tiller version v2.3.0 -also tested on: - k8s version v1.5.2 - Helm/Tiller v2.6.0 - -Download Helm: -https://github.com/kubernetes/helm diff --git a/kubernetes/common/Makefile b/kubernetes/common/Makefile index b9cc1250d5..a78cc88b89 100644 --- a/kubernetes/common/Makefile +++ b/kubernetes/common/Makefile @@ -19,7 +19,7 @@ PACKAGE_DIR := $(OUTPUT_DIR)/packages SECRET_DIR := $(OUTPUT_DIR)/secrets EXCLUDES := -HELM_CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) $(PARENT_CHART) +HELM_CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) .PHONY: $(EXCLUDES) $(HELM_CHARTS) diff --git a/kubernetes/dgbuilder/.helmignore b/kubernetes/common/dgbuilder/.helmignore index f0c1319444..f0c1319444 100644 --- a/kubernetes/dgbuilder/.helmignore +++ b/kubernetes/common/dgbuilder/.helmignore diff --git a/kubernetes/dgbuilder/Chart.yaml b/kubernetes/common/dgbuilder/Chart.yaml index e1955a137c..e1955a137c 100644 --- a/kubernetes/dgbuilder/Chart.yaml +++ b/kubernetes/common/dgbuilder/Chart.yaml diff --git a/kubernetes/dgbuilder/requirements.yaml b/kubernetes/common/dgbuilder/requirements.yaml index acca8ef7e2..acca8ef7e2 100644 --- a/kubernetes/dgbuilder/requirements.yaml +++ b/kubernetes/common/dgbuilder/requirements.yaml diff --git a/kubernetes/dgbuilder/resources/config/svclogic.properties b/kubernetes/common/dgbuilder/resources/config/svclogic.properties index fdaf5779e2..fdaf5779e2 100644 --- a/kubernetes/dgbuilder/resources/config/svclogic.properties +++ b/kubernetes/common/dgbuilder/resources/config/svclogic.properties diff --git a/kubernetes/dgbuilder/resources/scripts/createReleaseDir.sh b/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh index 38f7fe2720..38f7fe2720 100755 --- a/kubernetes/dgbuilder/resources/scripts/createReleaseDir.sh +++ b/kubernetes/common/dgbuilder/resources/scripts/createReleaseDir.sh diff --git a/kubernetes/dgbuilder/resources/scripts/customSettings.js b/kubernetes/common/dgbuilder/resources/scripts/customSettings.js index f09d396f96..f09d396f96 100644 --- a/kubernetes/dgbuilder/resources/scripts/customSettings.js +++ b/kubernetes/common/dgbuilder/resources/scripts/customSettings.js diff --git a/kubernetes/dgbuilder/templates/NOTES.txt b/kubernetes/common/dgbuilder/templates/NOTES.txt index 2465e03634..2465e03634 100644 --- a/kubernetes/dgbuilder/templates/NOTES.txt +++ b/kubernetes/common/dgbuilder/templates/NOTES.txt diff --git a/kubernetes/dgbuilder/templates/configmap.yaml b/kubernetes/common/dgbuilder/templates/configmap.yaml index 7ef92d09e7..7ef92d09e7 100644 --- a/kubernetes/dgbuilder/templates/configmap.yaml +++ b/kubernetes/common/dgbuilder/templates/configmap.yaml diff --git a/kubernetes/dgbuilder/templates/deployment.yaml b/kubernetes/common/dgbuilder/templates/deployment.yaml index 4e1f1019ee..4e1f1019ee 100644 --- a/kubernetes/dgbuilder/templates/deployment.yaml +++ b/kubernetes/common/dgbuilder/templates/deployment.yaml diff --git a/kubernetes/dgbuilder/templates/secrets.yaml b/kubernetes/common/dgbuilder/templates/secrets.yaml index 7604be8239..7604be8239 100644 --- a/kubernetes/dgbuilder/templates/secrets.yaml +++ b/kubernetes/common/dgbuilder/templates/secrets.yaml diff --git a/kubernetes/dgbuilder/templates/service.yaml b/kubernetes/common/dgbuilder/templates/service.yaml index c61cdd549b..c61cdd549b 100644 --- a/kubernetes/dgbuilder/templates/service.yaml +++ b/kubernetes/common/dgbuilder/templates/service.yaml diff --git a/kubernetes/dgbuilder/values.yaml b/kubernetes/common/dgbuilder/values.yaml index 23f8eea78e..23f8eea78e 100644 --- a/kubernetes/dgbuilder/values.yaml +++ b/kubernetes/common/dgbuilder/values.yaml diff --git a/kubernetes/mysql/.helmignore b/kubernetes/common/mysql/.helmignore index f0c1319444..f0c1319444 100644 --- a/kubernetes/mysql/.helmignore +++ b/kubernetes/common/mysql/.helmignore diff --git a/kubernetes/mysql/Chart.yaml b/kubernetes/common/mysql/Chart.yaml index 99e7c44fb9..99e7c44fb9 100644 --- a/kubernetes/mysql/Chart.yaml +++ b/kubernetes/common/mysql/Chart.yaml diff --git a/kubernetes/mysql/requirements.yaml b/kubernetes/common/mysql/requirements.yaml index acca8ef7e2..acca8ef7e2 100644 --- a/kubernetes/mysql/requirements.yaml +++ b/kubernetes/common/mysql/requirements.yaml diff --git a/kubernetes/mysql/templates/configmap.yaml b/kubernetes/common/mysql/templates/configmap.yaml index dd2b5b7db2..dd2b5b7db2 100644 --- a/kubernetes/mysql/templates/configmap.yaml +++ b/kubernetes/common/mysql/templates/configmap.yaml diff --git a/kubernetes/mysql/templates/nfs-provisoner.yaml b/kubernetes/common/mysql/templates/nfs-provisoner.yaml index 478224e1a1..478224e1a1 100644 --- a/kubernetes/mysql/templates/nfs-provisoner.yaml +++ b/kubernetes/common/mysql/templates/nfs-provisoner.yaml diff --git a/kubernetes/mysql/templates/pv.yaml b/kubernetes/common/mysql/templates/pv.yaml index ba128b95d0..ba128b95d0 100644 --- a/kubernetes/mysql/templates/pv.yaml +++ b/kubernetes/common/mysql/templates/pv.yaml diff --git a/kubernetes/mysql/templates/pvc.yaml b/kubernetes/common/mysql/templates/pvc.yaml index a2949fef36..a2949fef36 100644 --- a/kubernetes/mysql/templates/pvc.yaml +++ b/kubernetes/common/mysql/templates/pvc.yaml diff --git a/kubernetes/mysql/templates/secrets.yaml b/kubernetes/common/mysql/templates/secrets.yaml index 7604be8239..7604be8239 100644 --- a/kubernetes/mysql/templates/secrets.yaml +++ b/kubernetes/common/mysql/templates/secrets.yaml diff --git a/kubernetes/mysql/templates/service.yaml b/kubernetes/common/mysql/templates/service.yaml index c6a28c4605..c6a28c4605 100644 --- a/kubernetes/mysql/templates/service.yaml +++ b/kubernetes/common/mysql/templates/service.yaml diff --git a/kubernetes/mysql/templates/statefulset.yaml b/kubernetes/common/mysql/templates/statefulset.yaml index 7b55bf2be0..7b55bf2be0 100644 --- a/kubernetes/mysql/templates/statefulset.yaml +++ b/kubernetes/common/mysql/templates/statefulset.yaml diff --git a/kubernetes/mysql/templates/storageclass.yaml b/kubernetes/common/mysql/templates/storageclass.yaml index 1a4e6b6bb7..1a4e6b6bb7 100644 --- a/kubernetes/mysql/templates/storageclass.yaml +++ b/kubernetes/common/mysql/templates/storageclass.yaml diff --git a/kubernetes/mysql/values.yaml b/kubernetes/common/mysql/values.yaml index c0beb6fd22..c0beb6fd22 100644 --- a/kubernetes/mysql/values.yaml +++ b/kubernetes/common/mysql/values.yaml diff --git a/kubernetes/multicloud/templates/multicloud-windriver-deployment.yaml b/kubernetes/multicloud/templates/multicloud-windriver-deployment.yaml index 8d9ec35571..c1b385865b 100644 --- a/kubernetes/multicloud/templates/multicloud-windriver-deployment.yaml +++ b/kubernetes/multicloud/templates/multicloud-windriver-deployment.yaml @@ -66,7 +66,7 @@ spec: timeoutSeconds: 10 successThreshold: 1 failureThreshold: 5 - - image: {{ .Values.image.filebeat }} + - image: {{ .Values.image.filebeat }} imagePullPolicy: {{ .Values.pullPolicy }} name: filebeat-onap volumeMounts: diff --git a/kubernetes/oneclick/createAll.bash b/kubernetes/oneclick/createAll.bash deleted file mode 100755 index ded7c392ed..0000000000 --- a/kubernetes/oneclick/createAll.bash +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/bash - -. $(dirname "$0")/setenv.bash - - -usage() { - cat <<EOF -Usage: $0 [PARAMs] --u : Display usage --n [NAMESPACE] : Kubernetes namespace (required) --v [VALUES] : HELM values filepath (usefull when deploying one component at a time) --l [LOCATION] : Location of oom project --i [INSTANCE] : ONAP deployment instance # (default: 1) --a [APP] : Specify a specific ONAP component (default: all) - from the following choices: - sdc, aai ,mso, message-router, robot, vid, aaf, uui - sdnc, portal, policy, appc, multicloud, clamp, consul, vnfsdk -EOF -} - -check_return_code(){ - ret=$? - if [ $ret -ne 0 ]; then - printf "The command $1 returned with error code $ret \n" 1>&2 - exit $ret - fi -} - -create_service_account() { - cmd=`echo kubectl create clusterrolebinding $1-admin-binding --clusterrole=cluster-admin --serviceaccount=$1:default` - eval ${cmd} - check_return_code $cmd -} - -create_namespace() { - cmd=`echo kubectl create namespace $1` - eval ${cmd} -} - -create_registry_key() { -cmd=`echo kubectl --namespace $1 create secret docker-registry $2 --docker-server=$3 --docker-username=$4 --docker-password=$5 --docker-email=$6` - eval ${cmd} - check_return_code $cmd -} - -configure_dcaegen2() { - if [ ! -s "$OPENSTACK_PRIVATE_KEY_PATH" ] - then - echo "ERROR: $OPENSTACK_PRIVATE_KEY_PATH does not exist or is empty. Cannot launch dcae gen2." - return 1 - fi - - cmd=`echo kubectl --namespace $1-$2 create secret generic $2-openstack-ssh-private-key --from-file=key=${OPENSTACK_PRIVATE_KEY_PATH}` - eval ${cmd} - check_return_code $cmd - - if [ ! -s "$DCAEGEN2_CONFIG_INPUT_FILE_PATH" ] - then - echo "ERROR: $DCAEGEN2_CONFIG_INPUT_FILE_PATH does not exist or is empty. Cannot launch dcae gen2." - return 1 - fi - - cmd=`echo kubectl --namespace $1-$2 create configmap $2-config-inputs --from-file=inputs.yaml=${DCAEGEN2_CONFIG_INPUT_FILE_PATH}` - eval ${cmd} - check_return_code $cmd -} - -create_onap_helm() { - HELM_VALUES_ADDITION="" - if [[ ! -z $HELM_VALUES_FILEPATH ]]; then - HELM_VALUES_ADDITION="--values=$HELM_VALUES_FILEPATH" - fi - # Have to put a check for dcaegen2 because it requires external files to helm - # which should not be part of the Chart. - if [ "$2" = "dcaegen2" ]; - then - configure_dcaegen2 $1 $2 - local result=$? - if [ $result -ne 0 ] - then - echo "ERROR: dcaegen2 failed to configure: Pre-requisites not met. Skipping deploying it and continue" - return - fi - fi - - cmd=`echo helm install $LOCATION/$2/ --name $1-$2 --namespace $1 --set nsPrefix=$1,nodePortPrefix=$3 ${HELM_VALUES_ADDITION}` - eval ${cmd} - check_return_code $cmd -} - -#MAINs -NS= -HELM_VALUES_FILEPATH="" -LOCATION="../" -INCL_SVC=true -APP= -INSTANCE=1 -MAX_INSTANCE=5 -DU=$ONAP_DOCKER_USER -DP=$ONAP_DOCKER_PASS - -SINGLE_COMPONENT=false - -while getopts ":n:u:s:i:a:du:dp:l:v:" PARAM; do - case $PARAM in - u) - usage - exit 1 - ;; - n) - NS=${OPTARG} - ;; - v) - HELM_VALUES_FILEPATH=${OPTARG} - ;; - i) - INSTANCE=${OPTARG} - ;; - l) - LOCATION=${OPTARG} - ;; - a) - SINGLE_COMPONENT=true - APP=${OPTARG} - if [[ -z $APP ]]; then - usage - exit 1 - fi - ;; - du) - DU=${OPTARG} - ;; - dp) - DP=${OPTARG} - ;; - ?) - usage - exit - ;; - esac -done - -if [[ -z $NS ]]; then - usage - exit 1 -fi - -if [[ ! -z "$APP" ]]; then - HELM_APPS=($APP) -fi - - -if [ "$INSTANCE" -gt "$MAX_INSTANCE" ];then - printf "\n********** You choose to create ${INSTANCE}th instance of ONAP \n" - printf "\n********** Due to port allocation only ${MAX_INSTANCE} instances of ONAP is allowed per kubernetes deployment\n" - exit 1 -fi - -start=$((300+2*INSTANCE)) -end=$((start+1)) - -printf "\n********** Creating instance ${INSTANCE} of ONAP with port range ${start}00 and ${end}99\n" - - -printf "\n********** Creating ONAP: ${ONAP_APPS[*]}\n" - -if [ "$SINGLE_COMPONENT" == "false" ] -then - printf "\nCreating namespace **********\n" - create_namespace $NS - - printf "\nCreating registry secret **********\n" - create_registry_key $NS ${NS}-docker-registry-key $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL - - printf "\nCreating service account **********\n" - create_service_account $NS -fi - -printf "\n\n********** Creating deployments for ${HELM_APPS[*]} ********** \n" - -for i in ${HELM_APPS[@]}; do - - printf "\nCreating deployments and services **********\n" - create_onap_helm $NS $i $start - - printf "\n" -done - -printf "\n**** Done ****\n" diff --git a/kubernetes/oneclick/deleteAll.bash b/kubernetes/oneclick/deleteAll.bash deleted file mode 100755 index 9833af7909..0000000000 --- a/kubernetes/oneclick/deleteAll.bash +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/bash - -. $(dirname "$0")/setenv.bash - -delete_namespace() { - kubectl delete namespace $1 -} - -delete_service_account() { - kubectl delete clusterrolebinding $1-admin-binding -} - -delete_registry_key() { - kubectl --namespace $1 delete secret ${1}-docker-registry-key -} - -delete_app_helm() { - helm delete $1-$2 --purge -} - -wait_terminate() { - printf "Waiting for namespaces termination...\n" - while true; do - declare -i _STATUS=0 - for i in ${HELM_APPS[@]}; do - kubectl get pods --namespace $1 | grep -w " $i" > /dev/null 2>&1 - if [ "$?" -ne "0" ]; then - _STATUS=1 - break - fi - done - - if [ "$SINGLE_COMPONENT" == "false" ]; then - kubectl get namespaces $1 > /dev/null 2>&1 - _STATUS=$? - fi - if [ "$_STATUS" -ne "0" ]; then - break - fi - sleep 2 - done -} - -usage() { - cat <<EOF -Usage: $0 [PARAMs] --u : Display usage --n [NAMESPACE] : Kubernetes namespace (required) --c : kubectl context (default: current context) --y : Skip interactive confirmation (default: no) --a [APP] : Specify a specific ONAP component (default: all) - from the following choices: - sdc, aai ,mso, message-router, robot, vid, aaf, uui - sdnc, portal, policy, appc, multicloud, clamp, consul, vnfsdk --N : Do not wait for deletion of namespace and its objects -EOF -} - -#MAINs -NS= -INCL_SVC=false -APP= -WAIT_TERMINATE=true -SKIP_INTERACTIVE_CONFIRMATION=no -KUBECTL_CONTEXT= -SINGLE_COMPONENT=false -while getopts ":c:n:u:s:a:yN" PARAM; do - case $PARAM in - u) - usage - exit 1 - ;; - n) - NS=${OPTARG} - ;; - a) - APP=${OPTARG} - if [[ -z $APP ]]; then - usage - exit 1 - fi - SINGLE_COMPONENT=true - ;; - N) - WAIT_TERMINATE=false - ;; - y) - SKIP_INTERACTIVE_CONFIRMATION=yes - ;; - c) - KUBECTL_CONTEXT=${OPTARG} - ;; - ?) - usage - exit - ;; - esac -done - -if [[ -z $NS ]]; then - usage - exit 1 -fi - -if [[ "$SKIP_INTERACTIVE_CONFIRMATION" != yes ]]; then - current_kubectl_context=$(kubectl config get-contexts |grep "*" |awk '{print $2}') - if test "$KUBECTL_CONTEXT" != "$current_kubectl_context"; then - printf "Current kubectl context does not match context specified:\x1b[31m $current_kubectl_context\x1b[0m\n" - if [ ! -z "$KUBECTL_CONTEXT" -a "$KUBECTL_CONTEXT" != " " ]; then - read -p "Do you wish to switch context to $KUBECTL_CONTEXT and continue?" yn - case $yn in - [Yy]* ) kubectl config use-context $KUBECTL_CONTEXT;; - * ) printf "Skipping delete...\n"; exit;; - esac - else - printf "You are about to delete deployment from:\x1b[31m $current_kubectl_context\x1b[0m\n" - read -p "To continue enter context name: " response - - if test "$response" != "$current_kubectl_context" - then - printf "Your response does not match current context! Skipping delete ...\n" - exit 1 - fi - fi - fi -fi - -if [[ ! -z "$APP" ]]; then - HELM_APPS=($APP) -fi - -printf "\n********** Cleaning up ONAP: ${ONAP_APPS[*]}\n" - -for i in ${HELM_APPS[@]}; do - delete_app_helm $NS $i -done - -if [ "$SINGLE_COMPONENT" == "false" ] -then - delete_app_helm $NS "config" - delete_namespace $NS - delete_registry_key $NS - delete_service_account $NS -fi - -if $WAIT_TERMINATE; then - wait_terminate $NS -fi - -printf "\n********** Gone **********\n" diff --git a/kubernetes/oneclick/setenv.bash b/kubernetes/oneclick/setenv.bash deleted file mode 100644 index 716b76c410..0000000000 --- a/kubernetes/oneclick/setenv.bash +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# Deploying MSB first so the started ONAP services can be registered to MSB -HELM_APPS=('consul' 'msb' 'mso' 'message-router' 'sdnc' 'vid' 'robot' 'portal' 'policy' 'aai' 'sdc' 'dcaegen2' 'log' 'cli' 'multicloud' 'clamp' 'vnfsdk' 'uui' 'aaf' 'vfc' 'esr') -ONAP_DOCKER_REGISTRY=${ONAP_DOCKER_REGISTRY:-nexus3.onap.org:10001} -ONAP_DOCKER_USER=${ONAP_DOCKER_USER:-docker} -ONAP_DOCKER_PASS=${ONAP_DOCKER_PASS:-docker} -ONAP_DOCKER_MAIL=${ONAP_DOCKER_MAIL:-$USERNAME@$USERDOMAIN} -# Openstack key pair private key file location required to enable dcaegen2 installer CRUD operations in your Openstack -# Ensure you set the name of your keypair in the dcae-parameters.yaml entry "keypair: "dcae-g2" -# example: export OPENSTACK_PRIVATE_KEY_PATH=/home/user/Downloads/dcae-g2.pem -OPENSTACK_PRIVATE_KEY_PATH=${OPENSTACK_PRIVATE_KEY_PATH:-~/.ssh/onap_rsa} -# dcaegen2 bootstrap configuration input yaml file. Start from the sample, and set your environments real values: -# example: export DCAEGEN2_CONFIG_INPUT_FILE_PATH=/tmp/dcae-parameters.yaml -DCAEGEN2_CONFIG_INPUT_FILE_PATH=${DCAEGEN2_CONFIG_INPUT_FILE_PATH:-../dcaegen2/dcae-parameters-sample.yaml} diff --git a/kubernetes/oneclick/tools/autoCleanConfig.bash b/kubernetes/oneclick/tools/autoCleanConfig.bash deleted file mode 100644 index e274e0d0c5..0000000000 --- a/kubernetes/oneclick/tools/autoCleanConfig.bash +++ /dev/null @@ -1,54 +0,0 @@ -######################################################################################## -# This script wraps {$OOM}/kubernetes/oneclick/deleteAll.sh script along with # -# the following steps to clean up ONAP configure for specified namespace: # -# - remove namespace # -# - remove release # -# - remove shared directory # -# # -# To run it, just enter the following command: # -# ./autoCleanConfig.bash <namespace, default is "onap"> # -######################################################################################## -#!/bin/bash - - -NS=$1 -if [[ -z $NS ]] -then - echo "Namespace is not specified, use onap namespace." - NS="onap" -fi - -echo "Clean up $NS configuration" -cd .. -./deleteAll.bash -n $NS -y -cd - - -echo "---------------------------------------------- -Force remove namespace..." -kubectl delete namespace $NS -echo "...done : kubectl get namespace ------------------------------------------------ ->>>>>>>>>>>>>> k8s namespace" -kubectl get namespace -while [[ ! -z `kubectl get namespace|grep $NS` ]] -do - echo "Wait for namespace $NS to be deleted ------------------------------------------------ ->>>>>>>>>>>>>> k8s namespace" - kubectl get namespace - sleep 2 -done - -echo "Force delete helm process ..." -helm delete $NS-config --purge --debug -echo "...done : helm ls --all - ----------------------------------------------- ->>>>>>>>>>>>>> helm" -helm ls --all - -echo "Remove $NS dockerdata..." -sudo rm -rf /dockerdata-nfs/onap -echo "...done : ls -altr /dockerdata-nfs - ----------------------------------------------- ->>>>>>>>>>>>>> /dockerdata-nfs directory" -ls -altr /dockerdata-nfs diff --git a/kubernetes/oneclick/tools/autoCreateConfig.bash b/kubernetes/oneclick/tools/autoCreateConfig.bash deleted file mode 100644 index 99ea03e1bb..0000000000 --- a/kubernetes/oneclick/tools/autoCreateConfig.bash +++ /dev/null @@ -1,65 +0,0 @@ -######################################################################################## -# This script wraps {$OOM}/kubernetes/config/createConfig.sh script # -# and will only terminated when the configuration is Completed or failed # -# # -# To run it, just enter the following command: # -# ./autoCreateConfig.bash <namespace, default is "onap"> # -######################################################################################## -#!/bin/bash - - -NS=$1 -if [[ -z $NS ]] -then - echo "Namespace is not specified, use onap namespace." - NS="onap" -fi - -echo "Create $NS config under config directory..." -cd ../../config -./createConfig.sh -n $NS -cd - - - -echo "...done : kubectl get namespace ------------------------------------------------ ->>>>>>>>>>>>>> k8s namespace" -kubectl get namespace - - -echo " ------------------------------------------------ ->>>>>>>>>>>>>> helm : helm ls --all" -helm ls --all - - -echo " ------------------------------------------------ ->>>>>>>>>>>>>> pod : kubectl get pods -n $NS -a" -kubectl get pods -n $NS -a - - -while true -do - echo "wait for $NS config pod reach to Completed STATUS" - sleep 5 - echo "-----------------------------------------------" - kubectl get pods -n $NS -a - - status=`kubectl get pods -n $NS -a |grep config |xargs echo | cut -d' ' -f3` - - if [ "$status" = "Completed" ] - then - echo "$NS config is Completed!!!" - break - fi - - if [ "$status" = "Error" ] - then - echo " -$NS config is failed with Error!!! -Logs are:" - kubectl logs config -n $NS -f - break - fi -done diff --git a/kubernetes/oneclick/tools/collectInfo.bash b/kubernetes/oneclick/tools/collectInfo.bash deleted file mode 100644 index 734c5a6c62..0000000000 --- a/kubernetes/oneclick/tools/collectInfo.bash +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash - -NS= -OUT_NAME=onap_info_$(date +%y.%m.%d_%H.%M.%S.%N) -OUT_FILE= -OUT_DIR=$(dirname "$0") -TMP_DIR=$(dirname $(mktemp -u)) -CONTAINER_LOGS_PATH=/var/log/onap -CP_CONTAINER_LOGS=false - -if [ ! -z "$DEBUG" ]; then - set -x -fi - -usage() { - cat <<EOF -Utility script collecting various information about ONAP deployment on kubernetes. - -Usage: $0 [PARAMs] --u : Display usage --n [NAMESPACE] : Kubernetes namespace (required) --a [APP] : Specify a specific ONAP component (default: all) --d [OUT_DIR] : Specify output folder for the collected info pack file - (default: current dir) --f [OUT_FILE] : Specify output file for the collected info - (default: file name with timestamp) --c : Collect log files from containers, from path ${CONTAINER_LOGS_PATH} -EOF -} - -call_with_log() { - local _cmd=$1 - local _log=$2 - # Make sure otput dir exists - mkdir -p "$(dirname "$_log")" - printf "Command: ${_cmd}\n" >> ${_log} - printf "================================================================================\n" >> ${_log} - eval "${_cmd}" >> ${_log} 2>&1 - printf "================================================================================\n" >> ${_log} -} - -collect_pod_info() { - local _ns=$1 - local _id=$2 - local _log_dir=$3 - local _cp_logs=$4 - declare -i _i=0 - kubectl -n $_ns get pods $_id -o=jsonpath='{range .spec.containers[*]}{.name}{"\n"}{end}' | while read c; do - call_with_log "kubectl -n $_ns logs $_id -c $c" "$_log_dir/$_id-$c.log" - if [ "$_i" -eq "0" ] && [ "$_cp_logs" == "true" ]; then - # copy logs from 1st container only as logs dir is shared between the containers - local _cmd="kubectl cp $_ns/$_id:${CONTAINER_LOGS_PATH} $_log_dir/$_id-$c -c $c" - if [ -z "$DEBUG" ]; then - _cmd+=" > /dev/null 2>&1" - fi - eval "${_cmd}" - fi - ((_i++)) - done -} - -collect_ns_info() { - local _ns=$1 - local _log_dir=$2/$_ns - call_with_log "kubectl -n $NS-$i get services -o=wide" "$_log_dir/list_services.log" - kubectl -n "$_ns" get services | while read i; do - local _id=`echo -n $i | tr -s ' ' | cut -d' ' -n -f1` - if [ "$_id" == "NAME" ]; then - continue - fi - call_with_log "kubectl -n $_ns describe services $_id" "$_log_dir/describe_services/$_id.log" - done - call_with_log "kubectl -n $NS-$i get pods -o=wide" "$_log_dir/list_pods.log" - kubectl -n "$_ns" get pods | while read i; do - local _id=`echo -n $i | tr -s ' ' | cut -d' ' -n -f1` - if [ "$_id" == "NAME" ]; then - continue - fi - call_with_log "kubectl -n $_ns describe pods $_id" "$_log_dir/describe_pods/$_id.log" - collect_pod_info "$_ns" "$_id" "$_log_dir/logs" "${CP_CONTAINER_LOGS}" - done -} - -while getopts ":un:a:d:f:c" PARAM; do - case $PARAM in - u) - usage - exit 1 - ;; - n) - NS=${OPTARG} - ;; - a) - APP=${OPTARG} - if [[ -z $APP ]]; then - usage - exit 1 - fi - ;; - d) - OUT_DIR=${OPTARG} - if [[ -z $OUT_DIR ]]; then - usage - exit 1 - fi - ;; - f) - OUT_FILE=${OPTARG} - if [[ -z $OUT_FILE ]]; then - usage - exit 1 - fi - ;; - c) - CP_CONTAINER_LOGS=true - ;; - ?) - usage - exit - ;; - esac -done - -if [ -z "$NS" ]; then - usage - exit 1 -fi - -if [[ -z $OUT_FILE ]]; then - OUT_FILE=$OUT_NAME.tgz -fi - -if [ ! -z "$APP" ]; then - _APPS=($APP) -else - _APPS=(`kubectl get namespaces | grep "^$NS-" | tr -s ' ' | cut -d' ' -n -f1 | sed -e "s/^$NS-//"`) -fi - -printf "Collecting information about ONAP deployment...\n" -printf "Components: %s\n" "${_APPS[*]}" - -# Collect common info -mkdir -p ${TMP_DIR}/${OUT_NAME}/ -echo "${_APPS[*]}" > ${TMP_DIR}/${OUT_NAME}/component-list.log -printf "Collecting Helm info\n" -call_with_log "helm version" "${TMP_DIR}/${OUT_NAME}/helm-version.log" -call_with_log "helm list" "${TMP_DIR}/${OUT_NAME}/helm-list.log" - -printf "Collecting Kubernetes info\n" -call_with_log "kubectl version" "${TMP_DIR}/${OUT_NAME}/k8s-version.log" -call_with_log "kubectl get nodes -o=wide" "${TMP_DIR}/${OUT_NAME}/k8s-nodes.log" -call_with_log "kubectl cluster-info" "${TMP_DIR}/${OUT_NAME}/k8s-cluster-info.log" -call_with_log "kubectl cluster-info dump" "${TMP_DIR}/${OUT_NAME}/k8s-cluster-info-dump.log" -call_with_log "kubectl top node" "${TMP_DIR}/${OUT_NAME}/k8s-top-node.log" - -# Collect per-component info -for i in ${_APPS[@]}; do - printf "Writing Kubernetes info of component $i\n" - collect_ns_info "$NS-$i" "${TMP_DIR}/${OUT_NAME}" -done - -# Pack and cleanup -mkdir -p ${OUT_DIR} -_OUT_DIR=`readlink -e ${OUT_DIR}` -printf "Packing output to ${_OUT_DIR}/${OUT_FILE}...\n" -cd ${TMP_DIR} -tar cfz ${_OUT_DIR}/${OUT_FILE} ${OUT_NAME} -cd - -printf "Cleaning up...\n" -rm -rf ${TMP_DIR}/${OUT_NAME} -printf "Done\n" |