helm3 and K8 1.18 support added
[ric-plt/ric-dep.git] / bin / install
index 2a2424f..2607acc 100755 (executable)
@@ -62,6 +62,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 +93,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 "****************************************************************************************************************"
@@ -160,6 +166,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 +187,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 +198,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 +224,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
@@ -262,8 +288,13 @@ 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