Merge "helm3 and K8 1.18 support added"
authorPrabhu K <prabhu.k@nokia.com>
Mon, 23 Nov 2020 14:29:01 +0000 (14:29 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Mon, 23 Nov 2020 14:29:01 +0000 (14:29 +0000)
bin/install
bin/uninstall
helm/alarmadapter/templates/deployment.yaml
helm/appmgr/templates/deployment.yaml
helm/appmgr/templates/serviceaccount.yaml
helm/jaegeradapter/templates/deployment.yaml
helm/xapp-onboarder/templates/deployment.yaml

index eb95d93..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 "****************************************************************************************************************"
@@ -218,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
@@ -278,7 +288,12 @@ 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
+    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
 
index 51db408..fa8fc0a 100755 (executable)
@@ -32,12 +32,22 @@ INFRANAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *infra:/{print $2}')
 XAPPNAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *xapp:/{print $2}')
 RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
 
+IS_HELM3=$(helm version --short|grep -e "^v3")
 
 echo "Undeploying RIC platform components [$COMPONENTS]"
 
 
+HELM_FLAG=''
+if [ $IS_HELM3 ]
+then 
+  HELM_FLAG=' -n '${PLTNAMESPACE:-ricplt}
+else
+  HELM_FLAG='--purge'
+fi
+
+
 for component in $COMPONENTS; do
-    helm delete --purge ${RELEASE_PREFIX}-$component
+    helm delete $HELM_FLAG ${RELEASE_PREFIX}-$component
 done
 
 kubectl delete cm -n ${PLTNAMESPACE:-ricplt} ricplt-recipe
index 9b82ff3..8d02070 100644 (file)
@@ -64,7 +64,7 @@ spec:
           volumeMounts:
             - mountPath: /alarmadaptercfg
               name: appconfig-file
-              subpath: config-file.json
+              subPath: config-file.json
           ports:
             - name: "http"
               containerPort: {{ include "common.serviceport.alarmadapter.http" . }}
index f1c38e3..9fb698e 100644 (file)
@@ -131,11 +131,11 @@ spec:
           #  httpGet:
           #    path: /
           #    port: http
-          restartPolicy: Always
           securityContext:
             # ubuntu
             #runAsUser: 1000
             #allowPrivilegeEscalation: false
+      restartPolicy: Always
       volumes:
         - name: config-volume
           configMap:
index 407fb1f..13d1c39 100644 (file)
@@ -26,10 +26,9 @@ metadata:
   namespace: {{ include "common.namespace.platform" . }}
 ---
 apiVersion: rbac.authorization.k8s.io/v1beta1
-kind: Role
+kind: ClusterRole
 metadata:
   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-access
-  namespace: {{ include "common.tillerDeployNameSpace" $ctx }}
 rules:
 - apiGroups: [""]
   resources: ["pods/portforward"]
@@ -40,18 +39,18 @@ rules:
 {{- if or (eq (include "common.tillerTLSVerify" $ctx) "true" )  (eq (include "common.tillerTLSAuthenticate" $ctx) "true") }}
 - apiGroups: [""]
   resources: ["secrets"]
-  resourceNames: [ {{ include "common.tillerHelmClientTLSSecret" $ctx | quote }} ]
-  verbs: ["get"]
+  #resourceNames: [ {{ include "common.tillerHelmClientTLSSecret" $ctx | quote }} ]
+  verbs: ["get","list"]
 {{- end }}
 ---
 apiVersion: rbac.authorization.k8s.io/v1beta1
-kind: RoleBinding
+kind: ClusterRoleBinding
 metadata:
   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-access
-  namespace: {{ include "common.tillerDeployNameSpace" $ctx }}
+  namespace: {{ include "common.namespace.platform" . }}
 roleRef:
   apiGroup: rbac.authorization.k8s.io
-  kind: Role
+  kind: ClusterRole
   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-access
 subjects:
   - kind: ServiceAccount
@@ -59,23 +58,25 @@ subjects:
     namespace: {{ include "common.namespace.platform" . }}
 ---
 apiVersion: rbac.authorization.k8s.io/v1beta1
-kind: Role
+kind: ClusterRole
 metadata:
   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-getappconfig
-  namespace: {{ include "common.tillerNameSpace" $ctx }}
+  #namespace: {{ include "common.tillerNameSpace" $ctx }}
+  #namespace: {{ include "common.namespace.platform" . }}
 rules:
 - apiGroups: [""]
   resources: ["configmaps", "endpoints", "services"]
   verbs: ["get", "list", "create", "update", "delete"]
 ---
 apiVersion: rbac.authorization.k8s.io/v1beta1
-kind: RoleBinding
+kind: ClusterRoleBinding
 metadata:
   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.namespace.xapp" . }}-getappconfig
   namespace: {{ include "common.tillerNameSpace" $ctx }}
+  #namespace: {{ include "common.namespace.platform" . }}
 roleRef:
   apiGroup: rbac.authorization.k8s.io
-  kind: Role
+  kind: ClusterRole
   name: {{ include "common.serviceaccountname.appmgr" . }}-{{ include "common.tillerNameSpace" $ctx }}-getappconfig
 subjects:
   - kind: ServiceAccount
index ef319dd..9cdedfd 100644 (file)
@@ -82,4 +82,4 @@ spec:
             httpGet:
               path: /
               port: {{ include "common.serviceport.jaegeradapter.httpquery" . }}
-              initialDelaySeconds: 5
+            initialDelaySeconds: 5
index d43c730..cd8e2f7 100644 (file)
@@ -41,6 +41,10 @@ spec:
         release: {{ .Release.Name }}
     spec:
       hostname: {{ include "common.name.xapp-onboarder" . }}
+      securityContext:
+        fsGroup: 0
+        runAsUser: 0
+      restartPolicy: Always
       imagePullSecrets:
         {{- $newctx := dict "ctx" $ "defaultregistry" .Values.xapponboarder.image.xapponboarder.registry }}
         - name: {{ include "common.dockerregistry.credential" $newctx }}
@@ -50,9 +54,6 @@ spec:
           image: {{ include "common.dockerregistry.url" $newctx }}/{{ .Values.xapponboarder.image.chartmuseum.name }}:{{ .Values.xapponboarder.image.chartmuseum.tag }}
           {{- $newctx := dict "ctx" $ "defaultpullpolicy" .Values.xapponboarder.imagePullPolicy }}
           imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $newctx }}
-          securityContext:
-            fsGroup: 0
-            runAsUser: 0
           envFrom:
             - configMapRef:
                 name: {{ include "common.configmapname.xapp-onboarder" . }}-chartmuseum-env
@@ -86,4 +87,3 @@ spec:
           #  httpGet:
           #    path: /
           #    port: http
-          restartPolicy: Always