diff options
Diffstat (limited to 'kubernetes')
-rw-r--r-- | kubernetes/README_HELM | 20 | ||||
-rw-r--r-- | kubernetes/mso/Chart.yaml | 4 | ||||
-rw-r--r-- | kubernetes/mso/templates/all-services.yaml (renamed from kubernetes/mso/all-services.yaml) | 2 | ||||
-rw-r--r-- | kubernetes/mso/templates/db-deployment.yaml (renamed from kubernetes/mso/db-deployment.yaml) | 8 | ||||
-rw-r--r-- | kubernetes/mso/templates/mso-deployment.yaml (renamed from kubernetes/mso/mso-deployment.yaml) | 12 | ||||
-rw-r--r-- | kubernetes/mso/values.yaml | 7 | ||||
-rwxr-xr-x | kubernetes/oneclick/createAll.bash | 40 | ||||
-rwxr-xr-x | kubernetes/oneclick/deleteAll.bash | 11 | ||||
-rw-r--r-- | kubernetes/oneclick/setenv.bash | 3 |
9 files changed, 93 insertions, 14 deletions
diff --git a/kubernetes/README_HELM b/kubernetes/README_HELM new file mode 100644 index 0000000000..c1d5fdf432 --- /dev/null +++ b/kubernetes/README_HELM @@ -0,0 +1,20 @@ +Prerequisites: +- K8s +- Helm + +In order to use Helm with Rancher, check the tiller version installed +by runing "helm version" on the ranchr 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/mso/Chart.yaml b/kubernetes/mso/Chart.yaml new file mode 100644 index 0000000000..ad01a78d2d --- /dev/null +++ b/kubernetes/mso/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: A Helm chart for Kubernetes +name: mso +version: 0.1.0 diff --git a/kubernetes/mso/all-services.yaml b/kubernetes/mso/templates/all-services.yaml index 881ebba4a9..6e2db71650 100644 --- a/kubernetes/mso/all-services.yaml +++ b/kubernetes/mso/templates/all-services.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Service metadata: name: mariadb + namespace: {{ .Values.NS }} labels: app: mariadb spec: @@ -16,6 +17,7 @@ apiVersion: v1 kind: Service metadata: name: mso + namespace: {{ .Values.NS }} labels: app: mso spec: diff --git a/kubernetes/mso/db-deployment.yaml b/kubernetes/mso/templates/db-deployment.yaml index f57f4bac87..ff1cf75350 100644 --- a/kubernetes/mso/db-deployment.yaml +++ b/kubernetes/mso/templates/db-deployment.yaml @@ -2,6 +2,7 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: name: mariadb + namespace: {{ .Values.NS }} spec: replicas: 1 selector: @@ -16,7 +17,8 @@ spec: hostname: mariadb containers: - args: - image: nexus3.onap.org:10001/mariadb:10.1.11 + image: {{ .Values.image.mariadb }} + imagePullPolicy: {{ .Values.pullPolicy }} name: "mariadb" env: - name: MYSQL_ROOT_PASSWORD @@ -41,9 +43,9 @@ spec: volumes: - name: mso-mariadb-conf hostPath: - path: /dockerdata-nfs/onapdemo/mso/mariadb/conf.d + path: /dockerdata-nfs/onap/mso/mariadb/conf.d - name: mso-mariadb-docker-entrypoint-initdb hostPath: - path: /dockerdata-nfs/onapdemo/mso/mariadb/docker-entrypoint-initdb.d + path: /dockerdata-nfs/onap/mso/mariadb/docker-entrypoint-initdb.d imagePullSecrets: - name: onap-docker-registry-key diff --git a/kubernetes/mso/mso-deployment.yaml b/kubernetes/mso/templates/mso-deployment.yaml index fb052df734..6f12769d5a 100644 --- a/kubernetes/mso/mso-deployment.yaml +++ b/kubernetes/mso/templates/mso-deployment.yaml @@ -2,6 +2,7 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: name: mso + namespace: {{ .Values.NS }} spec: replicas: 1 selector: @@ -33,8 +34,8 @@ spec: } } ], - "image": "oomk8s/readiness-check:1.0.0", - "imagePullPolicy": "Always", + "image": "{{ .Values.image.readiness }}", + "imagePullPolicy": "{{ .Values.pullPolicy }}", "name": "mso-readiness" } ]' @@ -42,7 +43,8 @@ spec: containers: - command: - /docker-files/scripts/start-jboss-server.sh - image: nexus3.onap.org:10001/openecomp/mso:1.0-STAGING-latest + image: {{ .Values.image.mso }} + imagePullPolicy: {{ .Values.pullPolicy }} name: mso volumeMounts: - mountPath: /shared @@ -66,9 +68,9 @@ spec: volumes: - name: mso hostPath: - path: /dockerdata-nfs/onapdemo/mso/mso + path: /dockerdata-nfs/onap/mso/mso - name: mso-docker-files hostPath: - path: /dockerdata-nfs/onapdemo/mso/docker-files + path: /dockerdata-nfs/onap/mso/docker-files imagePullSecrets: - name: onap-docker-registry-key diff --git a/kubernetes/mso/values.yaml b/kubernetes/mso/values.yaml new file mode 100644 index 0000000000..41f9677029 --- /dev/null +++ b/kubernetes/mso/values.yaml @@ -0,0 +1,7 @@ +NS: onap-mso +pullPolicy: IfNotPresent +image: + readiness: oomk8s/readiness-check:1.0.0 + mso: nexus3.onap.org:10001/openecomp/mso:1.0-STAGING-latest + mariadb: nexus3.onap.org:10001/mariadb:10.1.11 + diff --git a/kubernetes/oneclick/createAll.bash b/kubernetes/oneclick/createAll.bash index 5e5f2dc76e..82956b8e7b 100755 --- a/kubernetes/oneclick/createAll.bash +++ b/kubernetes/oneclick/createAll.bash @@ -2,6 +2,7 @@ . $(dirname "$0")/setenv.bash + usage() { cat <<EOF Usage: $0 [PARAMs] @@ -31,13 +32,25 @@ create_service() { mv ../$2/all-services.yaml-- ../$2/all-services.yaml } + +create_onap_helm() { + helm install ../$2/ --name $2 +} + configure_app() { # if previous configuration exists put back original template file - for file in ../$2/*.yaml; do + for file in $3/*.yaml; do if [ -e "$file-template" ]; then mv "$file-template" "${file%}" fi done + + if [ -e "$2/Chart.yaml" ]; then + sed -i -- 's/nodePort: [0-9]\{2\}[02468]\{1\}/nodePort: '"$4"'/g' $3/all-services.yaml + sed -i -- 's/nodePort: [0-9]\{2\}[13579]\{1\}/nodePort: '"$5"'/g' $3/all-services.yaml + sed -i "s/onap-/$1-/g" ../$2/values.yaml + fi + # replace the default 'onap' namespace qualification of K8s hostnames within # the config files @@ -45,11 +58,11 @@ configure_app() { # this is not ideal and should be addressed (along with the replacement # of sed commands for configuration) by the future configuration # user stories (ie. OOM-51 to OOM-53) - find ../$2 -type f -exec sed -i -template "s/onap-/$1-/g" {} \; + find $3 -type f -exec sed -i -- "s/onap-/$1-/g" {} \; # replace the default '/dockerdata-nfs/onapdemo' volume mount paths - find ../$2 -iname "*.yaml" -type f -exec sed -i -e 's/dockerdata-nfs\/[a-zA-Z0-9\\-]*\//dockerdata-nfs\/'"$1"'\//g' {} \; - rm -f ../$2/*.yaml-e + find $3 -iname "*.yaml" -type f -exec sed -i -e 's/dockerdata-nfs\/[a-zA-Z0-9\\-]*\//dockerdata-nfs\/'"$1"'\//g' {} \; + rm -f $3/*.yaml-e } @@ -139,8 +152,25 @@ done printf "\n\n********** Creating deployments for ${ONAP_APPS[*]} ********** \n" for i in ${ONAP_APPS[@]}; do - configure_app $NS $i + _FILES_PATH=$(echo ../$i) + configure_app $NS $i $_FILES_PATH $start $end /bin/bash $i.sh $NS $i 'create' done +for i in ${HELM_APPS[@]}; do + printf "\nCreating namespace **********\n" + create_namespace $NS $i + + printf "\nCreating registry secret **********\n" + create_registry_key $NS $i $ONAP_DOCKER_REGISTRY_KEY $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL + + printf "\nCreating deployments and services **********\n" + _FILES_PATH=$(echo ../$i/templates) + configure_app $NS $i $_FILES_PATH $start $end + create_onap_helm $NS $i + + printf "\n" +done + printf "\n**** Done ****\n" + diff --git a/kubernetes/oneclick/deleteAll.bash b/kubernetes/oneclick/deleteAll.bash index 3d54aa80ae..ad7f060d12 100755 --- a/kubernetes/oneclick/deleteAll.bash +++ b/kubernetes/oneclick/deleteAll.bash @@ -20,6 +20,10 @@ delete_service() { kubectl --namespace $1-$2 delete -f ../$2/all-services.yaml } +delete_app_helm() { + helm delete $1 --purge +} + usage() { cat <<EOF Usage: $0 [PARAMs] @@ -88,5 +92,12 @@ for i in ${ONAP_APPS[@]}; do done +for i in ${HELM_APPS[@]}; do + + delete_app_helm $i + delete_namespace $NS $i + +done + printf "\n********** Gone **********\n" diff --git a/kubernetes/oneclick/setenv.bash b/kubernetes/oneclick/setenv.bash index 05a0d4760a..eb9bdb206c 100644 --- a/kubernetes/oneclick/setenv.bash +++ b/kubernetes/oneclick/setenv.bash @@ -1,6 +1,7 @@ #!/bin/bash -ONAP_APPS=('sdc' 'aai' 'mso' 'message-router' 'robot' 'vid' 'sdnc' 'portal' 'policy' 'appc') +HELM_APPS=('mso') +ONAP_APPS=('sdc' 'aai' 'message-router' 'robot' 'vid' 'sdnc' 'portal' 'policy' 'appc') ONAP_DOCKER_REGISTRY_KEY=${ONAP_DOCKER_REGISTRY_KEY:-onap-docker-registry-key} ONAP_DOCKER_REGISTRY=${ONAP_DOCKER_REGISTRY:-nexus3.onap.org:10001} ONAP_DOCKER_USER=${ONAP_DOCKER_USER:-docker} |