Merge "Add portal, aaf, onap charts and integrate with ric common template"
authorLusheng Ji <lji@research.att.com>
Wed, 11 Sep 2019 23:20:26 +0000 (23:20 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Wed, 11 Sep 2019 23:20:26 +0000 (23:20 +0000)
15 files changed:
RECIPE_EXAMPLE/RIC_PLATFORM_RECIPE_EXAMPLE
bin/gen-image-list [new file with mode: 0755]
bin/preload-images [new file with mode: 0755]
bin/prepull-images [new file with mode: 0755]
ric-aux/80-Auxiliary-Functions/helm/ves/templates/ingress-ves.yaml
ric-common/Common-Template/helm/ric-common/Chart.yaml
ric-common/Common-Template/helm/ric-common/templates/_configmapname.tpl
ric-common/Common-Template/helm/ric-common/templates/_kongpath.tpl [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/templates/ingress-a1mediator.yaml
ric-platform/50-RIC-Platform/helm/appmgr/templates/ingress-appmgr.yaml
ric-platform/50-RIC-Platform/helm/e2mgr/templates/ingress-e2mgr.yaml
ric-platform/50-RIC-Platform/helm/vespamgr/templates/deployment.yaml
ric-platform/50-RIC-Platform/helm/vespamgr/templates/secret.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/vespamgr/templates/vespa-config.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/vespamgr/values.yaml

index c8e9c04..0d9f1cc 100644 (file)
@@ -163,6 +163,8 @@ vespamgr:
   image:
     name: ric-plt-vespamgr
     tag: 0.0.1
+  prometheusurl: "http://rec-prometheus-server.default"
+
 
 # the service for redirecting to AUX cluster
 extsvcplt:
diff --git a/bin/gen-image-list b/bin/gen-image-list
new file mode 100755 (executable)
index 0000000..30386af
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/bash
+##############################################################################
+#
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+##############################################################################
+
+# Installs well-known RIC charts then verifies specified helm chart
+# Requires chart tgz archives in /tmp
+
+
+while [ -n "$1" ]; do # while loop starts
+
+    case "$1" in
+
+    -f) OVERRIDEYAML=$2
+        shift
+        ;; 
+    *) echo "Option $1 not recognized. Please use -f to specify the recipe path." ;; # In case you typed a different option other than a,b,c
+
+    esac
+
+    shift
+
+done
+
+if [ -z $OVERRIDEYAML ]; then
+   echo "Deploy recipe is missing. Please use -f to specify the recipe path."
+   exit 1
+fi
+
+
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+TEMP_DIR=/tmp
+rm -rf $TEMP_DIR/imagelist
+touch $TEMP_DIR/imagelist
+CHART_ARRAY=()
+while IFS= read -r -d $'\0'; do
+    CHART_ARRAY+=("$REPLY")
+done < <(find $ROOT_DIR/../ -name Chart.yaml -printf '%h\0')
+
+rm -fr $TEMP_DIR/ric-common*.tgz
+
+helm package -d $TEMP_DIR $ROOT_DIR/../ric-common/Common-Template/helm/ric-common
+echo "***************************************"
+
+
+
+for dir in "${CHART_ARRAY[@]}"
+do
+  
+    #rm -rf $dir/charts
+    rm -rf $dir/tmpcharts
+    echo "Analyzing Chart $(echo $dir | awk '{n=split($0, a, "/"); print a[n]}')"    
+    echo $dir 
+    mkdir -p $dir/charts
+    cp $TEMP_DIR/ric-common*.tgz $dir/charts/
+
+    helm dep up $dir > /dev/null 2>&1
+    
+    IMAGE_ARRAY=$(helm template -f $OVERRIDEYAML $dir | grep "image:" | awk '{ gsub(/.*image: /, "", $0); gsub(/"/, "", $0); print $0}' )
+    
+
+    for f in $IMAGE_ARRAY; do
+       if [ ! -z $f ]; then
+           FOUND=$(grep $f $TEMP_DIR/imagelist)
+           if [ -z $FOUND ]; then
+               echo "Found unique docker image $f."
+                echo $f >> $TEMP_DIR/imagelist
+           fi
+       fi
+    done
+
+    echo "***************************************"
+done
+
+
+
+echo "Your image list is available here: $TEMP_DIR/imagelist"
diff --git a/bin/preload-images b/bin/preload-images
new file mode 100755 (executable)
index 0000000..a8b6a4f
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/bash
+##############################################################################
+#
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+##############################################################################
+
+# Installs well-known RIC charts then verifies specified helm chart
+# Requires chart tgz archives in /tmp
+
+
+while [ -n "$1" ]; do # while loop starts
+
+    case "$1" in
+
+    -d) DOCKER_REGISTRY=$2
+        shift
+        ;;
+
+    -p) IMAGE_DIRECTORY_PATH=$2
+       shift
+       ;;
+
+    *) echo "Option $1 not recognized. Please specify the docker registry path with the -d option and specify the directory path of the images with the -p option."
+       ;; # In case you typed a different option other than -d or -p
+
+    esac
+
+    shift
+
+done
+
+if [ -z $DOCKER_REGISTRY ]; then
+   echo "Please specify the docker registry path with the -d option."
+   exit 1
+fi
+
+if [ -z $IMAGE_DIRECTORY_PATH ]; then
+   echo "Please specify the directory path of the images with the -p option."
+   exit 1
+fi
+
+
+
+
+for image in $IMAGE_DIRECTORY_PATH/*; do
+       OUTPUT=$(docker load -i $image)
+       IMAGE_PATH_ORIGINAL=$(echo $OUTPUT | grep image: | awk '{print $3}' )
+       IMAGENAME=$(echo $IMAGE_PATH_ORIGINAL | awk '{ n=split($0, a, "/"); print a[n] }')
+       echo "************************************************************"
+       echo "Loading image $IMAGENAME"
+        docker tag $IMAGE_PATH_ORIGINAL $DOCKER_REGISTRY/$IMAGENAME
+       RESULT=$(docker push $DOCKER_REGISTRY/$IMAGENAME 2>&1)
+        LOGIN_ERROR=$(echo $RESULT |& grep "no basic auth credentials" )
+       if [ ! -z "$LOGIN_ERROR" ]; then
+            echo "You are not logined to $DOCKER_REGISTRY. Please login by running \"docker login $DOCKER_REGISTRY\""
+           exit 1
+       fi
+        ACCESS_ERROR=$(echo $RESULT |& grep "denied: requested access to the resource is denied" )
+       if [ ! -z "$ACCESS_ERROR" ]; then
+            echo "Failed to push image to docker registry: <$DOCKER_REGISTRY>. Please check if it is a typo."
+           exit 1
+       fi
+done
diff --git a/bin/prepull-images b/bin/prepull-images
new file mode 100755 (executable)
index 0000000..0cd1cf9
--- /dev/null
@@ -0,0 +1,80 @@
+#!/bin/bash
+##############################################################################
+#
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+##############################################################################
+
+# Installs well-known RIC charts then verifies specified helm chart
+# Requires chart tgz archives in /tmp
+
+
+while [ -n "$1" ]; do # while loop starts
+
+    case "$1" in
+
+    -f) IMAGELISTFILE=$2
+        shift
+        ;; 
+
+
+    -d) IMAGE_DIRECTORY_PATH=$2
+        shift
+        ;;
+
+
+    *) echo "Option $1 not recognized. Please use -f to specify the recipe path." ;; # In case you typed a different option other than a,b,c
+
+    esac
+
+    shift
+
+done
+
+if [ -z "$IMAGELISTFILE" ]; then
+   echo "Image list file is missing. Please use -f to specify the path."
+   exit 1
+fi
+
+if [ -z "$IMAGE_DIRECTORY_PATH" ]; then
+    IMAGE_DIRECTORY_PATH=/tmp/ric_image
+fi
+
+
+rm -rf $IMAGE_DIRECTORY_PATH
+mkdir -p $IMAGE_DIRECTORY_PATH
+
+
+while IFS= read -r image
+do
+    IMAGENAME=$(echo $image | awk '{ n=split($0, a, "/"); print a[n] }')
+
+    echo "Pulling image $image"
+    RESULT=$(docker pull $image |& grep "no basic auth credentials" )
+    if [ ! -z "$RESULT" ]; then
+        echo "You are not logined to docker registry. Please login by running \"docker login DOCKER_REGISTRY\""
+       exit 1
+    fi
+
+    echo "Saving image $image"
+    docker save $image -o $IMAGE_DIRECTORY_PATH/$IMAGENAME
+
+    echo "************************************************************"
+
+
+done < "$IMAGELISTFILE"
+
+
+echo "RIC Images are downloaded to: $IMAGE_DIRECTORY_PATH"
index 4450bc6..4d56175 100644 (file)
@@ -6,7 +6,7 @@ spec:
   rules:
   - http:
       paths:
-      - path: /vescollector
+      - path: {{ include "common.kongpath.aux.vescollector" . }}
         backend:
           serviceName: {{ include "common.servicename.ves.http" . }}
           servicePort: {{ include "common.serviceport.ves.http" . }}
index 597dd54..3612f04 100644 (file)
@@ -18,4 +18,4 @@
 apiVersion: v1
 description: Common templates for inclusion in other charts
 name: ric-common
-version: 2.0.4
+version: 2.0.5
index c9fcebf..4b0a562 100644 (file)
   {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}}
 {{- end -}}
 
+{{- define "common.configmapname.vespamgr" -}}
+  {{- $name := ( include "common.fullname.vespamgr" . ) -}}
+  {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
 
 {{- define "common.configmapname.nexus" -}}
   {{- $name := ( include "common.fullname.nexus" . ) -}}
diff --git a/ric-common/Common-Template/helm/ric-common/templates/_kongpath.tpl b/ric-common/Common-Template/helm/ric-common/templates/_kongpath.tpl
new file mode 100644 (file)
index 0000000..736ffaa
--- /dev/null
@@ -0,0 +1,26 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#   Copyright (c) 2019 Nokia.                                                  #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+
+{{/*
+  This file defines the URL paths that kong proxies for different servicess.
+*/}}
+
+{{- define "common.kongpath.aux.vescollector" -}}/vescollector{{- end -}}
+{{- define "common.kongpath.aux.helm" -}}/helm{{- end -}}
+{{- define "common.kongpath.ric.appmgr" -}}/appmgr{{- end -}}
+{{- define "common.kongpath.ric.a1mediator" -}}/a1mediator{{- end -}}
+{{- define "common.kongpath.ric.e2mgr" -}}/e2mgr{{- end -}}
index 4d26d30..06e70b8 100644 (file)
@@ -6,7 +6,7 @@ spec:
   rules:
   - http:
       paths:
-      - path: /a1mediator
+      - path: {{ include "common.kongpath.ric.a1mediator" . }}
         backend:
           serviceName: {{ include "common.servicename.a1mediator.http" . }}
           servicePort: {{ include "common.serviceport.a1mediator.http" . }}
index 8123930..5bc0e94 100644 (file)
@@ -6,7 +6,7 @@ spec:
   rules:
   - http:
       paths:
-      - path: /appmgr
+      - path: {{ include "common.kongpath.ric.appmgr" . }}
         backend:
           serviceName: {{ include "common.servicename.appmgr.http" . }}
           servicePort: {{ include "common.serviceport.appmgr.http" . }}
index 23d1975..5176487 100644 (file)
@@ -6,7 +6,7 @@ spec:
   rules:
   - http:
       paths:
-      - path: /e2mgr
+      - path: {{ include "common.kongpath.ric.e2mgr" . }}
         backend:
           serviceName: {{ include "common.servicename.e2mgr.http" . }}
           servicePort: {{ include "common.serviceport.e2mgr.http" . }}
index 9ea0639..8f053aa 100644 (file)
@@ -50,10 +50,10 @@ spec:
             - name: http
               containerPort: {{ include "common.serviceport.vespamgr.http" . }}
               protocol: TCP
-          #envFrom:
-          #  - configMapRef:
-          #      name: vespa-config
-          #  - secretRef:
-          #      name: vespa-secrets
+          envFrom:
+            - configMapRef:
+                name: {{ include "common.configmapname.vespamgr" . }}
+            - secretRef:
+                name: vespa-secrets
 
 
diff --git a/ric-platform/50-RIC-Platform/helm/vespamgr/templates/secret.yaml b/ric-platform/50-RIC-Platform/helm/vespamgr/templates/secret.yaml
new file mode 100644 (file)
index 0000000..e321318
--- /dev/null
@@ -0,0 +1,9 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: vespa-secrets
+type: Opaque
+data:
+  VESMGR_PRICOLLECTOR_USER: ""
+  VESMGR_PRICOLLECTOR_PASSWORD: ""
diff --git a/ric-platform/50-RIC-Platform/helm/vespamgr/templates/vespa-config.yaml b/ric-platform/50-RIC-Platform/helm/vespamgr/templates/vespa-config.yaml
new file mode 100644 (file)
index 0000000..6149f15
--- /dev/null
@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.configmapname.vespamgr" . }}
+  namespace: {{ include "common.namespace.platform" . }}
+data:
+  VESMGR_HB_INTERVAL: "60s"
+  VESMGR_MEAS_INTERVAL: "30s"
+  VESMGR_PRICOLLECTOR_ADDR: {{ include "common.ingressurl.aux" . | quote }}
+  VESMGR_PRICOLLECTOR_SERVERROOT: {{ include "common.kongpath.aux.vescollector" . | quote }}
+  VESMGR_PRICOLLECTOR_PORT: {{ include "common.ingresshttpsport" . | quote }}
+  VESMGR_PRICOLLECTOR_SECURE: "false"
+  VESMGR_PROMETHEUS_ADDR: {{ .Values.vespamgr.prometheusurl }}
index 0b4024b..8485f46 100644 (file)
@@ -35,3 +35,5 @@ vespamgr:
   # ric-common/Common-Template/helm/ric-common/templates/_ports.tpl file.
   # If need to change a service port, make the code change necessary, then
   # update the _ports.tpl file with the new port number.
+  
+  prometheusurl: "http://rec-prometheus-server.default"