X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=helm%2Fdbaas%2Ftemplates%2Fconfigmap.yaml;fp=helm%2Fdbaasha%2Ftemplates%2Fconfigmap.yaml;h=9f82b1368f153bb4887a2918e427e8900a974629;hb=f882a9b97ac9dec5dfc2468f3150911e296132dc;hp=5a89c64b80ebafbcae0699e65d642c7eaf1087ac;hpb=393136323474cc68318eda4a674d91cc6aca0ffc;p=ric-plt%2Fric-dep.git diff --git a/helm/dbaasha/templates/configmap.yaml b/helm/dbaas/templates/configmap.yaml similarity index 78% rename from helm/dbaasha/templates/configmap.yaml rename to helm/dbaas/templates/configmap.yaml index 5a89c64..9f82b13 100644 --- a/helm/dbaasha/templates/configmap.yaml +++ b/helm/dbaas/templates/configmap.yaml @@ -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. # @@ -18,38 +18,39 @@ 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 }}