################################################################################
-# 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() {
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
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
fi
echo "Ready..."
+
+{{- end }}