Update deployment scripts and recipe to the latest 98/3398/2
authorZhe Huang <zhehuang@research.att.com>
Wed, 22 Apr 2020 17:04:47 +0000 (13:04 -0400)
committerZhe Huang <zhehuang@research.att.com>
Thu, 23 Apr 2020 15:21:36 +0000 (11:21 -0400)
This commit includes the following changes.
*Add automation to create k8s cluster rules needed to deploy platform components
*Disable kernel optimization by default. Add argument option to enable kernel optimization.
*Update recipe with new container versions.

Signed-off-by: Zhe Huang <zhehuang@research.att.com>
Change-Id: Ic3dc04b23cd217949df9e5316637ff076406582c

bin/install
bin/setup-ric-common-template

index bc9a4ba..2a2424f 100755 (executable)
@@ -61,6 +61,7 @@ function wait_for_cats() {
   echo
 }
 
+KERNEL_OPTIMIZATION=false
 
 while [ -n "$1" ]; do # while loop starts
 
@@ -72,6 +73,8 @@ while [ -n "$1" ]; do # while loop starts
     -c) LIST_OF_COMPONENTS=$2
         shift
         ;;
+    -o) KERNEL_OPTIMIZATION=true
+        ;;
     *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c
 
     esac
@@ -134,7 +137,77 @@ if [ ! -z "$LOCAL_REPOSITORY" ]; then
 fi
 
 
+echo Add cluster roles
+    cat >ricplt-role.yaml <<EOF
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+  name: ricplt-system-tiller
+rules:
+  - apiGroups: [""]
+    resources: ["deployments"]
+    verbs: ["get", "list", "create", "delete"]
+  - apiGroups: ["apiextensions.k8s.io"]
+    resources: ["customresourcedefinitions"]
+    verbs: ["get", "list", "create", "delete"]
+  - apiGroups: ["rbac.authorization.k8s.io"]
+    resources: ["clusterroles", "clusterrolebindings"]
+    verbs: ["get", "list", "create", "delete"]
+  - apiGroups: [""]
+    resources: ["events"]
+    verbs: ["create", "patch"]
+  - apiGroups: [""]
+    resources: ["nodes"]
+    verbs: ["list", "watch", "get"]
+  - apiGroups: ["configuration.konghq.com"]
+    resources: ["kongconsumers"]
+    verbs: ["get", "list", "watch"]
+  - apiGroups: ["configuration.konghq.com"]
+    resources: ["kongcredentials"]
+    verbs: ["get", "list", "watch"]
+  - apiGroups: ["configuration.konghq.com"]
+    resources: ["kongingresses"]
+    verbs: ["get", "list", "watch"]
+  - apiGroups: ["configuration.konghq.com"]
+    resources: ["kongplugins"]
+    verbs: ["get", "list", "watch"]
+  - apiGroups: ["networking.k8s.io"]
+    resources: ["ingresses"]
+    verbs: ["watch", "list", "get", "create", "delete", "update"]
+  - apiGroups: [""]
+    resources: ["persistentvolumes"]
+    verbs: ["watch", "list", "get", "create", "delete"]
+  - apiGroups: ["danm.k8s.io"]
+    resources: ["clusternetworks"]
+    verbs: ["watch", "list", "get", "create", "delete"]
+  - apiGroups: ["extensions"]
+    resources: ["ingresses/status"]
+    verbs: ["update"]
+  - apiGroups: ["networking.k8s.io"]
+    resources: ["ingresses/status"]
+    verbs: ["update"]
+---
+
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+  name: ricplt-system-tiller
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: ricplt-system-tiller
+subjects:
+  - kind: ServiceAccount
+    name: tiller
+    namespace: kube-system
+EOF
+kubectl apply -f ricplt-role.yaml
+rm ricplt-role.yaml
+
+
 # Add kernel optimization for radis services
+if $KERNEL_OPTIMIZATION; then
     cat >kernel_optimizer.yaml <<EOF
 apiVersion: apps/v1
 kind: DaemonSet
@@ -184,6 +257,7 @@ wait_for_pods redis-kernel-optimizer ${INFRANAMESPACE:-ricinfra}
 wait_for_cats redis-kernel-optimizer ${INFRANAMESPACE:-ricinfra}
 kubectl delete -f kernel_optimizer.yaml
 rm kernel_optimizer.yaml
+fi
 
 
 for component in $COMPONENTS; do
index bd7bb64..73fd422 100755 (executable)
@@ -22,7 +22,7 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
 
 # Download it/dep common template charts
 #git clone "https://gerrit.o-ran-sc.org/r/it/dep" ../dep
-git clone --single-branch --branch r3 "https://gerrit.o-ran-sc.org/r/it/dep" ../dep
+git clone --single-branch "https://gerrit.o-ran-sc.org/r/it/dep" ../dep
 
 # Start Helm local repo if there isn't one
 HELM_REPO_PID=$(ps -x | grep  "helm serve" | grep -v "grep" | awk '{print $1}')
@@ -38,7 +38,7 @@ cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $HELM_HOME/repository/local/
 
 AUX_COMMON_CHART_VERSION=$(cat $ROOT_DIR/../dep/ric-common/Common-Template/helm/aux-common/Chart.yaml | grep version | awk '{print $2}')
 helm package -d /tmp $ROOT_DIR/../dep/ric-common/Common-Template/helm/aux-common
-cp /tmp/aux-common-$COMMON_CHART_VERSION.tgz $HELM_HOME/repository/local/
+cp /tmp/aux-common-$AUX_COMMON_CHART_VERSION.tgz $HELM_HOME/repository/local/