X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=bin%2Finstall;h=3285d7f6e19da697c1c1af976f092071d9964ff8;hb=9fb18847091767093c624c715137c621113d71c4;hp=2a2424fa1fda1fa39f05e1cf1f8f294179e01352;hpb=1d417dcc634d51b240f373773698f46eeef77e84;p=ric-plt%2Fric-dep.git diff --git a/bin/install b/bin/install index 2a2424f..3285d7f 100755 --- a/bin/install +++ b/bin/install @@ -2,6 +2,7 @@ ################################################################################ # Copyright (c) 2019 AT&T Intellectual Property. # # Copyright (c) 2019 Nokia. # +# Copyright (c) 2021 HCL Technologies Limited. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -62,6 +63,7 @@ function wait_for_cats() { } KERNEL_OPTIMIZATION=false +IS_HELM3=$(helm version --short|grep -e "^v3") while [ -n "$1" ]; do # while loop starts @@ -92,7 +94,12 @@ if [ -z "$OVERRIDEYAML" ];then exit 1 fi -HAS_COMMON_PACKAGE=$(helm search local/ric-common | grep ric-common) +if [ -z $IS_HELM3 ] +then + HAS_COMMON_PACKAGE=$(helm search local/ric-common | grep ric-common) +else + HAS_COMMON_PACKAGE=$(helm search repo local/ric-common | grep ric-common) +fi if [ -z "$HAS_COMMON_PACKAGE" ];then echo "****************************************************************************************************************" @@ -112,11 +119,6 @@ XAPPNAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *xapp:/{print $2}') RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}') LOCAL_REPOSITORY=$(echo "$COMMON_BLOCK" | awk '/^ *localregistry:/{print $2}') -# replace the dbaasha with dbaas1 if deploying non HA DBaaS -COMPONENTS=${LIST_OF_COMPONENTS:-"infrastructure dbaas xapp-onboarder appmgr rtmgr e2mgr e2term a1mediator submgr vespamgr jaegeradapter o1mediator alarmadapter"} -echo "Deploying RIC infra components [$COMPONENTS]" - - if ! kubectl get ns ${PLTNAMESPACE:-ricplt}> /dev/null 2>&1; then kubectl create ns ${PLTNAMESPACE:-ricplt} fi @@ -126,6 +128,32 @@ fi if ! kubectl get ns ${XAPPNAMESPACE:-ricxapp}> /dev/null 2>&1; then kubectl create ns ${XAPPNAMESPACE:-ricxapp} fi + +IS_INFLUX_PERSIST=$( kubectl get storageclass nfs 2>/dev/null | awk '{print $1}' | grep nfs) +if [[ ${LIST_OF_COMPONENTS} == *"influxdb"* ]]; then + if [ -z "$IS_INFLUX_PERSIST" ]; then + echo "nfs storage does not exist, create PersistentVolume through the storage class for the influxdb database" + LIST_OF_COMPONENTS=$(echo "$LIST_OF_COMPONENTS" | sed "s/influxdb//") + echo "skipping influxdb component" + else + echo "nfs storage exist" + fi +fi + +# replace the dbaasha with dbaas1 if deploying non HA DBaaS +COMPONENTS="infrastructure dbaas appmgr rtmgr e2mgr e2term a1mediator submgr vespamgr o1mediator alarmmanager $LIST_OF_COMPONENTS" + +echo "Deploying RIC infra components [$COMPONENTS]" +if [[ ${COMPONENTS} != *"influxdb"* ]]; then + OPTIONAL_COMPONENTS="influxdb" +fi +if [[ ${COMPONENTS} != *"jaegeradapter"* ]]; then + OPTIONAL_COMPONENTS={"$OPTIONAL_COMPONENTS jaegeradapter"} +fi +if [ ! -z "$OPTIONAL_COMPONENTS" ]; then + echo "Note that the following optional components are NOT being deployed: $OPTIONAL_COMPONENTS. To deploy them add them with -c to the default component list of the install command" +fi + FOUND_RECIPE=$(kubectl get configmap -n ${PLTNAMESPACE:-ricplt} ricplt-recipe 2>/dev/null ) if [ ! -z "$FOUND_RECIPE" ]; then kubectl delete configmap -n ${PLTNAMESPACE:-ricplt} ricplt-recipe @@ -160,6 +188,12 @@ rules: - apiGroups: [""] resources: ["nodes"] verbs: ["list", "watch", "get"] + - apiGroups: [""] + resources: ["nodes/metrics"] + verbs: ["list", "watch", "get"] + - apiGroups: [""] + resources: ["nodes/proxy"] + verbs: ["list", "watch", "get"] - apiGroups: ["configuration.konghq.com"] resources: ["kongconsumers"] verbs: ["get", "list", "watch"] @@ -175,6 +209,9 @@ rules: - apiGroups: ["networking.k8s.io"] resources: ["ingresses"] verbs: ["watch", "list", "get", "create", "delete", "update"] + - apiGroups: [""] + resources: ["ingresses"] + verbs: ["watch", "list", "get", "create", "delete", "update"] - apiGroups: [""] resources: ["persistentvolumes"] verbs: ["watch", "list", "get", "create", "delete"] @@ -183,12 +220,19 @@ rules: verbs: ["watch", "list", "get", "create", "delete"] - apiGroups: ["extensions"] resources: ["ingresses/status"] - verbs: ["update"] + verbs: ["update", "get", "list", "watch"] - apiGroups: ["networking.k8s.io"] resources: ["ingresses/status"] - verbs: ["update"] + verbs: ["update", "get", "list", "watch"] + - apiGroups: ["certificates.k8s.io"] + resources: ["certificatesigningrequests"] + verbs: ["list", "watch"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["list", "watch"] + - nonResourceURLs: ["/metrics"] + verbs: ["get"] --- - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: @@ -202,8 +246,12 @@ subjects: name: tiller namespace: kube-system EOF -kubectl apply -f ricplt-role.yaml -rm ricplt-role.yaml + +if [ -z $IS_HELM3 ] +then + kubectl apply -f ricplt-role.yaml + rm ricplt-role.yaml +fi # Add kernel optimization for radis services @@ -259,11 +307,15 @@ kubectl delete -f kernel_optimizer.yaml rm kernel_optimizer.yaml fi - for component in $COMPONENTS; do helm dep up $DIR/../helm/$component - helm install -f $OVERRIDEYAML --namespace "${PLTNAMESPACE:-ricplt}" --name "${RELEASE_PREFIX}-$component" $DIR/../helm/$component - sleep 3 + COMPONENT="${RELEASE_PREFIX}-$component" + if [ -z $IS_HELM3 ] + then + COMPONENT=" --name $COMPONENT" + fi + helm install -f $OVERRIDEYAML --namespace "${PLTNAMESPACE:-ricplt}" $COMPONENT $DIR/../helm/$component + sleep 8 done