DBaaS standalone and HA version update 45/3145/6
authorknowpd <knowpd@research.att.com>
Fri, 3 Apr 2020 20:44:09 +0000 (16:44 -0400)
committerLusheng Ji <lji@research.att.com>
Wed, 15 Apr 2020 01:54:09 +0000 (01:54 +0000)
This version of the helm charts combine the DBAAS SA and HA charts.
Client applications should include the appconfig configmap as environment variables.
Server host kernel optimization has been included in the ric-dep bin deployment scripts.

Note:
 - SDL library will automatically recognize whether it is using HA or SA version of DBAAS.
 - The client should make sure that it uses the upgraded SDL library that supports dbaasha.

Change-Id: I40f05ec8bdf7ade68029ecb64fc6a8413c34a247
Signed-off-by: knowpd <knowpd@research.att.com>
16 files changed:
RECIPE_EXAMPLE/example_recipe.yaml
bin/install
bin/uninstall
helm/dbaas/Chart.yaml [moved from helm/dbaasha/Chart.yaml with 85% similarity]
helm/dbaas/requirements.yaml [moved from helm/dbaas1/requirements.yaml with 88% similarity]
helm/dbaas/templates/appconfig.yaml [moved from helm/dbaasha/templates/healthchecks.yaml with 56% similarity]
helm/dbaas/templates/configmap.yaml [moved from helm/dbaasha/templates/configmap.yaml with 78% similarity]
helm/dbaas/templates/service.yaml [moved from helm/dbaasha/templates/service.yaml with 86% similarity]
helm/dbaas/templates/statefulset.yaml [moved from helm/dbaasha/templates/statefulset.yaml with 55% similarity]
helm/dbaas/values.yaml [moved from helm/dbaasha/values.yaml with 62% similarity]
helm/dbaas1/Chart.yaml [deleted file]
helm/dbaas1/templates/deployment.yaml [deleted file]
helm/dbaas1/templates/service.yaml [deleted file]
helm/dbaas1/values.yaml [deleted file]
helm/dbaasha/requirements.yaml [deleted file]
helm/dbaasha/templates/announce-service.yaml [deleted file]

index 8747a4c..7a2b16a 100644 (file)
@@ -20,7 +20,6 @@
 
 common:
   releasePrefix: r4
-
 # If a local docker registry is used, please specify it using the following option 
 #  localregistry: nexus3.o-ran-sc.org:10004
 
@@ -79,21 +78,16 @@ appmgr:
      name: chartmuseum/chartmuseum
      tag: v0.8.2
 
-dbaas:
-  backend:
-    image:
-      registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
-      name: ric-plt-dbaas
-      tag: 0.1.0
 
-dbaasha:
+dbaas:
   image:
     registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
     name: ric-plt-dbaas
     tag: 0.2.2
-  # Remove the affinity line below when deploying in a k8s
-  # cluster of more than 3 nodes.
-  affinity: ""
+  enableHighAvailability: true
+  # Enable pod anti affinity only if you have more than 3 k8s nodes
+  enablePodAntiAffinity: false
+
 
 e2mgr:
   image:
index e705e5e..bc9a4ba 100755 (executable)
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
+
+function wait_for_pods() {
+  echo -n "waiting for $1 pods to run"
+
+  STILL_WAITING=true
+  while $STILL_WAITING; do
+      STILL_WAITING=false
+      PODS=$(kubectl get pods -n $2 2>/dev/null | grep $1 | awk '{print $1}')
+      if [ -z $PODS ]; then
+        STILL_WAITING=true
+        sleep 1
+        echo -n "."
+      fi
+      for POD in ${PODS}; do
+        if [[ $(kubectl get pod ${POD} -n $2 -o go-template --template "{{.status.phase}}") != "Running" ]]; then
+           STILL_WAITING=true
+           sleep 1
+            echo -n "."
+           break
+       fi
+      done 
+  done
+
+  echo
+}
+
+function wait_for_cats() {
+  echo -n "waiting for $1 daemonset to complete"
+
+  STILL_WAITING=true
+  while $STILL_WAITING; do
+      STILL_WAITING=false
+      PODS=$(kubectl get pods -n $2 | grep $1 | awk '{print $1}')
+      for POD in ${PODS}; do
+        if [[ $(kubectl logs ${POD} -n $2 --tail 1) != "done" ]]; then
+           STILL_WAITING=true
+           sleep 1
+            echo -n "."
+           break
+       fi
+      done 
+  done
+
+  echo
+}
+
+
 while [ -n "$1" ]; do # while loop starts
 
     case "$1" in
@@ -53,25 +100,17 @@ if [ -z "$HAS_COMMON_PACKAGE" ];then
     exit 1
 fi
 
-
-
-
-
-
-
-
-
-
-
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
-COMMON_BLOCK=$(cat $OVERRIDEYAML | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
-NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^  namespace:/{getline; while ($0 ~ /^    .*|^ *$/) {print $0; if (getline == 0) {break}}}')
+COMMON_BLOCK=$(cat $OVERRIDEYAML | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *|^ *#.*$/) {print $0; if (getline == 0) {break}}}')
+NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^  namespace:/{getline; while ($0 ~ /^ +.*|^ *|^ *#.*$/) {print $0; if (getline == 0) {break}}}')
 PLTNAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *platform:/{print $2}')
 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}')
+LOCAL_REPOSITORY=$(echo "$COMMON_BLOCK" | awk '/^ *localregistry:/{print $2}')
+
 # replace the dbaasha with dbaas1 if deploying non HA DBaaS
-COMPONENTS=${LIST_OF_COMPONENTS:-"infrastructure xapp-onboarder appmgr rtmgr dbaas1 e2mgr e2term a1mediator submgr vespamgr jaegeradapter o1mediator alarmadapter"}
+COMPONENTS=${LIST_OF_COMPONENTS:-"infrastructure dbaas xapp-onboarder appmgr rtmgr e2mgr e2term a1mediator submgr vespamgr jaegeradapter o1mediator alarmadapter"}
 echo "Deploying RIC infra components [$COMPONENTS]"
 
 
@@ -84,12 +123,75 @@ fi
 if ! kubectl get ns ${XAPPNAMESPACE:-ricxapp}> /dev/null 2>&1; then
     kubectl create ns ${XAPPNAMESPACE:-ricxapp}
 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
+fi
 kubectl create configmap -n ${PLTNAMESPACE:-ricplt} ricplt-recipe --from-file=recipe=$OVERRIDEYAML
 
+if [ ! -z "$LOCAL_REPOSITORY" ]; then
+    LOCAL_REPOSITORY="$LOCAL_REPOSITORY/"
+fi
+
+
+# Add kernel optimization for radis services
+    cat >kernel_optimizer.yaml <<EOF
+apiVersion: apps/v1
+kind: DaemonSet
+metadata:
+  namespace: ${INFRANAMESPACE:-ricinfra}
+  name: redis-kernel-optimizer
+spec:
+  selector:
+    matchLabels:
+      app: redis-kernel-optimizer
+  template:
+    metadata:
+      labels:
+        app: redis-kernel-optimizer
+    spec:
+      volumes:
+      - name: sys
+        hostPath:
+          path: /sys
+      containers:
+      - name: disable-thp
+        image: ${LOCAL_REPOSITORY}busybox
+        securityContext:
+          runAsNonRoot: false
+          privileged: true
+          runAsUser: 0
+        command: ["sh", "-c"]
+        args:
+        - |-
+          set -e
+          set -o pipefail
+          trap 'exit' TERM
+          echo never > /rootfs/sys/kernel/mm/transparent_hugepage/enabled
+          echo never > /rootfs/sys/kernel/mm/transparent_hugepage/defrag
+          sysctl -w net.core.somaxconn=511
+          grep -q -F [never] /sys/kernel/mm/transparent_hugepage/enabled
+          grep -q -F [never] /sys/kernel/mm/transparent_hugepage/defrag
+          sysctl -n net.core.somaxconn | grep 511 -q
+          echo "done"
+          while true; do sleep 1; done
+        volumeMounts:
+        - name: sys
+          mountPath: /rootfs/sys
+EOF
+kubectl apply -f kernel_optimizer.yaml
+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
+
 
 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
 done
+
+
+
+
index bb3091b..51db408 100755 (executable)
@@ -16,7 +16,7 @@
 #   limitations under the License.                                             #
 ################################################################################
 
-COMPONENTS="xapp-onboarder appmgr rtmgr dbaas1 dbaasha e2mgr e2term a1mediator submgr vespamgr jaegeradapter infrastructure o1mediator alarmadapter"
+COMPONENTS="xapp-onboarder appmgr rtmgr e2mgr e2term a1mediator submgr vespamgr jaegeradapter dbaas infrastructure o1mediator alarmadapter"
 RECIPE_NAMESPACE=$(kubectl get cm --all-namespaces | grep ricplt-recipe | awk '{print $1}')
 kubectl get configmap  -n $RECIPE_NAMESPACE ricplt-recipe  -o jsonpath='{.data.recipe}' > /tmp/recipe.yaml
 
similarity index 85%
rename from helm/dbaasha/Chart.yaml
rename to helm/dbaas/Chart.yaml
index a6bd0da..aa21230 100644 (file)
@@ -1,6 +1,6 @@
 ################################################################################
-#   Copyright (c) 2019 AT&T Intellectual Property.                             #
-#   Copyright (c) 2019 Nokia.                                                  #
+#   Copyright (c) 2020 AT&T Intellectual Property.                             #
+#   Copyright (c) 2020 Nokia.                                                  #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
@@ -17,6 +17,6 @@
 
 apiVersion: v1
 appVersion: "1.0"
-description: DBaaS with high availability
-name: dbaasha
-version: 1.1.0
+description: DBaaS service backend helm charts
+name: dbaas
+version: 2.0.0
similarity index 88%
rename from helm/dbaas1/requirements.yaml
rename to helm/dbaas/requirements.yaml
index ad561b2..aa68385 100644 (file)
@@ -1,5 +1,6 @@
 ################################################################################
-#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#   Copyright (c) 2020 AT&T Intellectual Property.                             #
+#   Copyright (c) 2020 Nokia.                                                  #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
@@ -16,5 +17,5 @@
 
 dependencies:
   - name: ric-common
-    version: ^3.1.0
+    version: ^3.2.0
     repository: "@local"
similarity index 56%
rename from helm/dbaasha/templates/healthchecks.yaml
rename to helm/dbaas/templates/appconfig.yaml
index ac3575a..a26e352 100644 (file)
@@ -1,6 +1,6 @@
 ################################################################################
-#   Copyright (c) 2019 AT&T Intellectual Property.                             #
-#   Copyright (c) 2019 Nokia.                                                  #
+#   Copyright (c) 2020 AT&T Intellectual Property.                             #
+#   Copyright (c) 2020 Nokia.                                                  #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-
+{{ $platformNameSpace := include "common.namespace.platform" . }}
+{{ $xAppNameSpace := include "common.namespace.xapp" . }}
+{{ $nameSpaceList := list $platformNameSpace $xAppNameSpace }}
+{{- range $nameSpaceList }}
+{{- $namespace := . }}
+---
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ template "common.configmapname.dbaasha" . }}-probes
-  labels:
-    heritage: {{ .Release.Service }}
-    release: {{ .Release.Name }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }}
+{{- if eq $namespace $platformNameSpace }}
+  name: {{ include "common.configmapname.dbaas" $ }}-appconfig
+{{- else }}
+  name: dbaas-appconfig
+{{- end }}
+  namespace: {{ $namespace }}
 data:
-  readiness.sh: |
-    #!/bin/sh
-    set -eu
-    CHECK_SERVER="$(timeout -t "$2" redis-cli -p "$1"{{ if .Values.auth }} -a "$AUTH"{{ end }} ping)"
-
-    if [ "$CHECK_SERVER" != "PONG" ]; then
-        echo "Server check failed with: $CHECK_SERVER"
-        exit 1
-    fi
+{{- if $.Values.dbaas.enableHighAvailability }}
+  DBAAS_SERVICE_SENTINEL_PORT: {{ include "common.serviceport.dbaas.sentinel" . | quote }}
+  DBAAS_MASTER_NAME: {{ $.Values.dbaas.redis.masterGroupName }}
+{{- end }}
+  DBAAS_SERVICE_HOST: {{ include "common.servicename.dbaas.tcp" $ }}.{{ $platformNameSpace }}
+  DBAAS_SERVICE_PORT: {{ include "common.serviceport.dbaas.redis" $ | quote }}
+{{- end }}
similarity index 78%
rename from helm/dbaasha/templates/configmap.yaml
rename to helm/dbaas/templates/configmap.yaml
index 5a89c64..9f82b13 100644 (file)
@@ -1,6 +1,6 @@
 ################################################################################
-#   Copyright (c) 2019 AT&T Intellectual Property.                             #
-#   Copyright (c) 2019 Nokia.                                                  #
+#   Copyright (c) 2020 AT&T Intellectual Property.                             #
+#   Copyright (c) 2020 Nokia.                                                  #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ template "common.configmapname.dbaasha" . }}-config
+  name: {{ template "common.configmapname.dbaas" . }}-config
   labels:
     heritage: {{ .Release.Service }}
     release: {{ .Release.Name }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version }}
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }}
+    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
 data:
   redis.conf: |
     dir "/data"
-    {{- range $key, $value := .Values.dbaasha.redis.config }}
+    {{- range $key, $value := .Values.dbaas.redis.config }}
     {{ $key }} {{ $value }}
     {{- end }}
 
+{{- if $.Values.dbaas.enableHighAvailability }}
   sentinel.conf: |
     dir "/data"
     {{- $root := . -}}
-    {{- range $key, $value := .Values.dbaasha.sentinel.config }}
-    sentinel {{ $key }} {{ $root.Values.dbaasha.redis.masterGroupName }} {{ $value }}
+    {{- range $key, $value := .Values.dbaas.sentinel.config }}
+    sentinel {{ $key }} {{ $root.Values.dbaas.redis.masterGroupName }} {{ $value }}
     {{- end }}
-    protected-mode {{ index .Values.dbaasha.sentinel "protected-mode" }}
+    protected-mode {{ index .Values.dbaas.sentinel "protected-mode" }}
 
   init.sh: |
     HOSTNAME="$(hostname)"
     INDEX="${HOSTNAME##*-}"
-    MASTER="$(redis-cli -h {{ template "common.servicename.dbaasha.tcp" . }}.{{ .Release.Namespace }}.svc.cluster.local -p {{ include "common.serviceport.dbaasha.sentinel" .  }} sentinel get-master-addr-by-name {{ .Values.dbaasha.redis.masterGroupName }} | grep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
-    MASTER_GROUP="{{ .Values.dbaasha.redis.masterGroupName }}"
-    QUORUM="{{ .Values.dbaasha.sentinel.quorum }}"
+    MASTER="$(redis-cli -h {{ template "common.servicename.dbaas.tcp" . }}.{{ include "common.namespace.platform" . }} -p {{ include "common.serviceport.dbaas.sentinel" .  }} sentinel get-master-addr-by-name {{ .Values.dbaas.redis.masterGroupName }} | grep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
+    MASTER_GROUP="{{ .Values.dbaas.redis.masterGroupName }}"
+    QUORUM="{{ .Values.dbaas.sentinel.quorum }}"
     REDIS_CONF=/data/conf/redis.conf
-    REDIS_PORT={{ include "common.serviceport.dbaasha.redis" . }}
+    REDIS_PORT={{ include "common.serviceport.dbaas.redis" . }}
     SENTINEL_CONF=/data/conf/sentinel.conf
-    SENTINEL_PORT={{ include "common.serviceport.dbaasha.sentinel" . }}
-    SERVICE={{ template "common.fullname.dbaasha" . }}
+    SENTINEL_PORT={{ include "common.serviceport.dbaas.sentinel" . }}
+    SERVICE={{ include "common.servicename.dbaas.tcp" . }}
     set -eu
 
     sentinel_update() {
@@ -89,7 +90,7 @@ data:
             redis_master_update
             sentinel_update "$ANNOUNCE_IP"
         else
-            DEFAULT_MASTER="$(getent hosts "$SERVICE-announce-0" | awk '{ print $1 }')"
+            DEFAULT_MASTER="$(getent hosts "{{ include "common.statefulsetname.dbaas" . }}-server-0.$SERVICE" | awk '{ print $1 }')"
             if [ -z "$DEFAULT_MASTER" ]; then
                 echo "Unable to resolve host"
                 exit 1
@@ -129,7 +130,7 @@ data:
     echo "Initializing config.."
     copy_config
 
-    ANNOUNCE_IP=$(getent hosts "$SERVICE-announce-$INDEX" | awk '{ print $1 }')
+    #    ANNOUNCE_IP=$(getent hosts "{{ include "common.statefulsetname.dbaas" . }}-server-$INDEX.$SERVICE" | awk '{ print $1 }')
     if [ -z "$ANNOUNCE_IP" ]; then
         "Could not resolve the announce ip for this pod"
         exit 1
@@ -145,3 +146,5 @@ data:
     fi
 
     echo "Ready..."
+
+{{- end }}
similarity index 86%
rename from helm/dbaasha/templates/service.yaml
rename to helm/dbaas/templates/service.yaml
index 4aab7be..f4f476e 100644 (file)
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-
+---
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ include "common.servicename.dbaasha.tcp" . }}
+  name: {{ include "common.servicename.dbaas.tcp" . }}
   labels:
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }}
+    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
@@ -29,13 +29,15 @@ spec:
   clusterIP: None
   ports:
   - name: server
-    port: {{ include "common.serviceport.dbaasha.redis" . }}
+    port: {{ include "common.serviceport.dbaas.redis" . }}
     protocol: TCP
     targetPort: redis
+{{- if $.Values.dbaas.enableHighAvailability }}
   - name: sentinel
-    port: {{ include "common.serviceport.dbaasha.sentinel" . }}
+    port: {{ include "common.serviceport.dbaas.sentinel" . }}
     protocol: TCP
     targetPort: sentinel
+{{- end }}
   selector:
     release: {{ .Release.Name }}
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }}
+    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
similarity index 55%
rename from helm/dbaasha/templates/statefulset.yaml
rename to helm/dbaas/templates/statefulset.yaml
index 9b068da..217f22b 100644 (file)
 #   See the License for the specific language governing permissions and        #
 #   limitations under the License.                                             #
 ################################################################################
-{{- $ctx := dict "ctx" . "defaultregistry" .Values.dbaasha.image.registry }}
+{{- $ctx := dict "ctx" . "defaultregistry" .Values.dbaas.image.registry }}
 ---
 apiVersion: apps/v1
 kind: StatefulSet
 metadata:
-  name: {{ include "common.statefulsetname.dbaasha" . }}-server
+  name: {{ include "common.statefulsetname.dbaas" . }}-server
   namespace: {{ include "common.namespace.platform" . }}
   labels:
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }}
+    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
   selector:
     matchLabels:
-      app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }}
+      app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
       release: {{ .Release.Name }}
-  serviceName: {{ template "common.servicename.dbaasha.tcp" . }}
-  replicas: {{ .Values.dbaasha.replicas }}
+  serviceName: {{ template "common.servicename.dbaas.tcp" . }}
+{{- if $.Values.dbaas.enableHighAvailability }}
+  replicas: {{ .Values.dbaas.haReplicas }}
+{{- else }}
+  replicas: {{ .Values.dbaas.saReplicas }}
+{{- end }}
   podManagementPolicy: OrderedReady
   updateStrategy:
     type: RollingUpdate
   template:
     metadata:
       labels:
-        app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }}
+        app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
         release: {{ .Release.Name }}
     spec:
-      {{- if .Values.dbaasha.nodeSelector }}
-      nodeSelector:
-{{ toYaml .Values.dbaasha.nodeSelector | indent 8 }}
-      {{- end }}
-    {{- with .Values.dbaasha.affinity }}
+{{- if $.Values.dbaas.enablePodAntiAffinity }}
       affinity:
-{{ tpl . $ | indent 8 }}
-    {{- end }}
+        podAntiAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+            - labelSelector:
+                matchLabels:
+                  app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
+                  release: {{ .Release.Name }}
+              topologyKey: kubernetes.io/hostname
+          preferredDuringSchedulingIgnoredDuringExecution:
+            - weight: 100
+              podAffinityTerm:
+                labelSelector:
+                  matchLabels:
+                    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
+                    release: {{ .Release.Name }}
+                topologyKey: topology.kubernetes.io/zone
+{{- end }}
       imagePullSecrets:
-        {{- $ctx := dict "ctx" . "defaultregistry" .Values.dbaasha.image.registry }}
+        {{- $ctx := dict "ctx" . "defaultregistry" .Values.dbaas.image.registry }}
         - name: {{ include "common.dockerregistry.credential" $ctx }}
+      terminationGracePeriodSeconds: {{ .Values.dbaas.terminationGracePeriodSeconds }}
+{{- if $.Values.dbaas.enableHighAvailability }}
       initContainers:
-      {{- if .Values.dbaasha.sysctlImage.enabled }}
-      - name: init-systctl
-        image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaasha.image.name }}:{{ .Values.dbaasha.image.tag }}
-        imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $ctx  }}
-        {{ if .Values.dbaasha.sysctlImage.mountHostSys }}
-        volumeMounts:
-          - name: host-sys
-            mountPath: /host-sys
-        {{- end }}
-        command:
-{{ toYaml .Values.dbaasha.sysctlImage.command | indent 10 }}
-        securityContext:
-          runAsNonRoot: false
-          privileged: true
-          runAsUser: 0
-      {{- end }}
       - name: config-init
-        image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaasha.image.name }}:{{ .Values.dbaasha.image.tag }}
+        image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaas.image.name }}:{{ .Values.dbaas.image.tag }}
         imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $ctx  }}
         command:
         - sh
         args:
         - /readonly-config/init.sh
+        env:
+        - name: ANNOUNCE_IP
+          valueFrom:
+            fieldRef:
+              fieldPath: status.podIP
         volumeMounts:
         - name: config
           mountPath: /readonly-config
           readOnly: true
         - name: data
           mountPath: /data
+{{- end }}
       containers:
-      - name: {{ include "common.containername.dbaasha.redis" . }}
-        image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaasha.image.name }}:{{ .Values.dbaasha.image.tag }}
+      - name: {{ include "common.containername.dbaas" . }}-redis
+        image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaas.image.name }}:{{ .Values.dbaas.image.tag }}
         imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $ctx  }}
         command:
         - redis-server
         args:
+{{- if $.Values.dbaas.enableHighAvailability }}
         - /data/conf/redis.conf
+{{- else }}
+        - /data/redis.conf
+{{- end }}
         livenessProbe:
           exec:
-            command: [ "sh", "/probes/readiness.sh", {{ include "common.serviceport.dbaasha.redis" . | quote }}, {{ .Values.dbaasha.probeTimeout | quote }}]
+            command: 
+            - /bin/sh
+            - -c
+            - timeout -t {{ .Values.dbaas.probeTimeout }} redis-cli -p {{ include "common.serviceport.dbaas.redis" . }} ping
           initialDelaySeconds: 15
           periodSeconds: 5
         readinessProbe:
           exec:
-            command: [ "sh", "/probes/readiness.sh", {{ include "common.serviceport.dbaasha.redis" . | quote }}, {{ .Values.dbaasha.probeTimeout | quote }}]
+            command: 
+            - /bin/sh
+            - -c
+            - timeout -t {{ .Values.dbaas.probeTimeout }} redis-cli -p {{ include "common.serviceport.dbaas.redis" . }} ping
           initialDelaySeconds: 15
           periodSeconds: 5
         ports:
         - name: redis
-          containerPort: {{ include "common.serviceport.dbaasha.redis" . }}
+          containerPort: {{ include "common.serviceport.dbaas.redis" . }}
         volumeMounts:
         - mountPath: /data
+{{- if $.Values.dbaas.enableHighAvailability }}
           name: data
-        - mountPath: /probes
-          name: probes
-      - name: {{ include "common.containername.dbaasha.sentinel" . }}
-        image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaasha.image.name }}:{{ .Values.dbaasha.image.tag }}
+      - name: {{ include "common.containername.dbaas" . }}-sentinel
+        image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaas.image.name }}:{{ .Values.dbaas.image.tag }}
         imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $ctx  }}
         command:
           - redis-server
@@ -119,33 +134,34 @@ spec:
           - --sentinel
         livenessProbe:
           exec:
-            command: [ "sh", "/probes/readiness.sh", {{ include "common.serviceport.dbaasha.redis" . | quote }}, {{ .Values.dbaasha.probeTimeout | quote }}]
+            command: 
+            - /bin/sh
+            - -c
+            - timeout -t {{ .Values.dbaas.probeTimeout }} redis-cli -p {{ include "common.serviceport.dbaas.redis" . }} ping
           initialDelaySeconds: 15
           periodSeconds: 5
         readinessProbe:
           exec:
-            command: [ "sh", "/probes/readiness.sh", {{ include "common.serviceport.dbaasha.redis" . | quote }}, {{ .Values.dbaasha.probeTimeout | quote }}]
+            command: 
+            - /bin/sh
+            - -c
+            - timeout -t {{ .Values.dbaas.probeTimeout }} redis-cli -p {{ include "common.serviceport.dbaas.redis" . }} ping
           initialDelaySeconds: 15
           periodSeconds: 5
         ports:
           - name: sentinel
-            containerPort: {{ include "common.serviceport.dbaasha.sentinel" . }}
+            containerPort: {{ include "common.serviceport.dbaas.sentinel" . }}
         volumeMounts:
         - mountPath: /data
           name: data
-        - mountPath: /probes
-          name: probes
+{{- else }}
+          name: config
+{{- end }}
       volumes:
       - name: config
         configMap:
-          name: {{ template "common.configmapname.dbaasha" . }}-config
-      - name: probes
-        configMap:
-          name: {{ template "common.configmapname.dbaasha" . }}-probes
-      {{- if .Values.dbaasha.sysctlImage.mountHostSys }}
-      - name: host-sys
-        hostPath:
-          path: /sys
-      {{- end }}
+          name: {{ template "common.configmapname.dbaas" . }}-config
+{{- if $.Values.dbaas.enableHighAvailability }}
       - name: data
         emptyDir: {}
+{{- end }}
similarity index 62%
rename from helm/dbaasha/values.yaml
rename to helm/dbaas/values.yaml
index 69c0446..c81ef98 100644 (file)
@@ -1,6 +1,6 @@
 ################################################################################
-#   Copyright (c) 2019 AT&T Intellectual Property.                             #
-#   Copyright (c) 2019 Nokia.                                                  #
+#   Copyright (c) 2020 AT&T Intellectual Property.                             #
+#   Copyright (c) 2020 Nokia.                                                  #
 #                                                                              #
 #   Licensed under the Apache License, Version 2.0 (the "License");            #
 #   you may not use this file except in compliance with the License.           #
 #   limitations under the License.                                             #
 ################################################################################
 
-dbaasha:
+dbaas:
   image:
     registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
     name: ric-plt-dbaas
     tag: 0.2.2
   imagePullPolicy: IfNotPresent
-  replicas: 3
-  enabled: true
-  sysctlImage:
-    enabled: true
-    command:
-      - /bin/sh
-      - -c
-      - |-
-        sysctl -w net.core.somaxconn=511
-        echo never > /host-sys/kernel/mm/transparent_hugepage/enabled
-    mountHostSys: true
-  probeTimeout: 10
+  enableHighAvailability: false
+  enablePodAntiAffinity: false
+  terminationGracePeriodSeconds: 5
+
   redis:
     masterGroupName: dbaasmaster
     config:
@@ -43,6 +35,8 @@ dbaasha:
       maxmemory-policy: "volatile-lru"
       protected-mode: "no"
       loadmodule: "/usr/local/libexec/redismodule/libredismodule.so"
+      bind: 0.0.0.0
+
   sentinel:
     quorum: 2
     protected-mode: "no"
@@ -51,19 +45,7 @@ dbaasha:
       down-after-milliseconds: 5000
       failover-timeout: 60000
       parallel-syncs: 1
-  affinity: |
-    podAntiAffinity:
-      requiredDuringSchedulingIgnoredDuringExecution:
-        - labelSelector:
-            matchLabels:
-              app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }}
-              release: {{ .Release.Name }}
-          topologyKey: kubernetes.io/hostname
-      preferredDuringSchedulingIgnoredDuringExecution:
-        - weight: 100
-          podAffinityTerm:
-            labelSelector:
-              matchLabels:
-                app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaasha" . }}
-                release: {{ .Release.Name }}
-            topologyKey: failure-domain.beta.kubernetes.io/zone
+
+  saReplicas: 1
+  haReplicas: 3
+  probeTimeout: 10
diff --git a/helm/dbaas1/Chart.yaml b/helm/dbaas1/Chart.yaml
deleted file mode 100644 (file)
index 7a5e4a4..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-################################################################################
-#   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.                                             #
-################################################################################
-
-apiVersion: v1
-appVersion: "1.0"
-description: DBaaS realized with standalone, non-persistent, non-redundant Redis
-name: dbaas1
-version: 3.0.0
diff --git a/helm/dbaas1/templates/deployment.yaml b/helm/dbaas1/templates/deployment.yaml
deleted file mode 100644 (file)
index 6146ff3..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-################################################################################
-#   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.                                             #
-################################################################################
-
-
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  name: {{ include "common.deploymentname.dbaas" . }}
-  namespace: {{ include "common.namespace.platform" . }}
-  labels:
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  replicas: {{ .Values.dbaas.backend.replicas }}
-  selector:
-    matchLabels:
-      app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
-      release: {{ .Release.Name }}
-  template:
-    metadata:
-      {{- if .Values.dbaas.annotations }}
-      annotations:
-        {{- .Values.dbaas.annotations | nindent 8 -}}
-      {{ end }}
-      labels:
-        app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
-        release: {{ .Release.Name }}
-    spec:
-      imagePullSecrets:
-       {{- $ctx := dict "ctx" . "defaultregistry" .Values.dbaas.backend.image.registry }}
-       - name: {{ include "common.dockerregistry.credential" $ctx }}
-      terminationGracePeriodSeconds: {{ .Values.dbaas.backend.terminationGracePeriodSeconds }}
-      containers:
-      - image: {{ include "common.dockerregistry.url" $ctx }}/{{ .Values.dbaas.backend.image.name }}:{{ .Values.dbaas.backend.image.tag }}
-        {{- $ctx := dict "ctx" . "defaultpullpolicy" .Values.dbaas.backend.imagePullPolicy }}
-        imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $ctx  }}
-        ports:
-        - containerPort: {{ include "common.serviceport.dbaas.tcp" . }}
-          name: sql
-          protocol: TCP
-        name: {{ include "common.containername.dbaas" . }}
-      restartPolicy: Always
diff --git a/helm/dbaas1/templates/service.yaml b/helm/dbaas1/templates/service.yaml
deleted file mode 100644 (file)
index 591594b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-################################################################################
-#   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.                                             #
-################################################################################
-
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ include "common.servicename.dbaas.tcp" . }}
-  namespace: {{ include "common.namespace.platform" . }}
-  labels:
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }} 
-spec:
-  selector:
-    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.dbaas" . }}
-    release: {{ .Release.Name }}
-  ports:
-  - port: {{ include "common.serviceport.dbaas.tcp" . }}
-    targetPort: "sql"
-    protocol: "TCP"
-    name: "sql"
diff --git a/helm/dbaas1/values.yaml b/helm/dbaas1/values.yaml
deleted file mode 100644 (file)
index 10dc52f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-################################################################################
-#   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.                                             #
-################################################################################
-
-dbaas:
-  backend:
-    terminationGracePeriodSeconds: 0
-    replicas: 1
-    imagePullPolicy: IfNotPresent
-    image:
-      name: ric-plt-dbaas
-      tag: 0.1.0
-      registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
-
-    # Service ports are now defined in
-    # 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.
diff --git a/helm/dbaasha/requirements.yaml b/helm/dbaasha/requirements.yaml
deleted file mode 100644 (file)
index 2aa6bce..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-################################################################################
-#   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.                                             #
-################################################################################
-
-dependencies:
-  - name: ric-common
-    version: ^3.1.0
-    repository: "@local"
-  #- name: dbaasha
-  #  condition: dbaasha.enabled
diff --git a/helm/dbaasha/templates/announce-service.yaml b/helm/dbaasha/templates/announce-service.yaml
deleted file mode 100644 (file)
index 3352ffb..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-################################################################################
-#   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.                                             #
-################################################################################
-{{- $fullName := include "common.fullname.dbaasha" . }}
-{{- $podName := include "common.statefulsetname.dbaasha" . }}
-{{- $appName := include "common.name.dbaasha" . }}
-{{- $platformName := include "common.namespace.platform" . }}
-{{- $replicas := int .Values.dbaasha.replicas }}
-{{- $redisPort := include "common.serviceport.dbaasha.redis" .}}
-{{- $sentinelPort := include "common.serviceport.dbaasha.sentinel" .}}
-{{- $root := . }}
-{{- range $i := until $replicas }}
----
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ $fullName }}-announce-{{ $i }}
-  labels:
-    app: {{ $platformName }}-{{ $appName }}
-    chart: {{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}
-    release: {{ $root.Release.Name }}
-    heritage: {{ $root.Release.Service }}
-spec:
-  publishNotReadyAddresses: true
-  type: ClusterIP
-  ports:
-  - name: server
-    port: {{ $redisPort }}
-    protocol: TCP
-    targetPort: redis
-  - name: sentinel
-    port: {{ $sentinelPort }}
-    protocol: TCP
-    targetPort: sentinel
-  selector:
-    release: {{ $root.Release.Name }}
-    app: {{ $platformName }}-{{ $appName }}
-    "statefulset.kubernetes.io/pod-name": {{ $podName }}-server-{{ $i }}
-{{- end }}