summaryrefslogtreecommitdiffstats
path: root/kubernetes
diff options
context:
space:
mode:
authorMike Elliott <mike.elliott@amdocs.com>2018-04-05 01:07:40 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-05 01:07:40 +0000
commit4624c12f60bf3d469d2008122902df8d5410952d (patch)
tree766573d1cb0a77501ffea955a33b82ee38dcf5e3 /kubernetes
parentad6382f57e802ced0892ea103bf880e11050590b (diff)
parentbaadb38f90168c15b9fc6007b507269ff5c47551 (diff)
Merge "Multi-site High-availability Manual Failover (PoC)"
Diffstat (limited to 'kubernetes')
-rw-r--r--kubernetes/common/mysql/templates/service.yaml24
-rw-r--r--kubernetes/common/mysql/templates/statefulset.yaml6
-rw-r--r--kubernetes/common/mysql/values.yaml3
3 files changed, 31 insertions, 2 deletions
diff --git a/kubernetes/common/mysql/templates/service.yaml b/kubernetes/common/mysql/templates/service.yaml
index c6a28c4605..db08c3a454 100644
--- a/kubernetes/common/mysql/templates/service.yaml
+++ b/kubernetes/common/mysql/templates/service.yaml
@@ -88,3 +88,27 @@ spec:
app: {{ include "common.name" . }}
release: {{ .Release.Name }}
clusterIP: None
+---
+{{ if .Values.geoEnabled }}
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ .Values.service.name }}-nodeport
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0
+spec:
+ ports:
+ - name: {{ .Values.service.internalPort }}
+ port: {{ .Values.service.internalPort }}
+ targetPort: {{ .Values.service.internalPort }}
+ nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort1 }}
+ - name: {{ .Values.xtrabackup.internalPort }}
+ port: {{ .Values.xtrabackup.internalPort }}
+ targetPort: {{ .Values.xtrabackup.internalPort }}
+ nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.externalPort2 }}
+ type: NodePort
+ selector:
+ statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0
+ release: {{ .Release.Name }}
+{{ end }}
diff --git a/kubernetes/common/mysql/templates/statefulset.yaml b/kubernetes/common/mysql/templates/statefulset.yaml
index 7b55bf2be0..e3f3428fbd 100644
--- a/kubernetes/common/mysql/templates/statefulset.yaml
+++ b/kubernetes/common/mysql/templates/statefulset.yaml
@@ -45,10 +45,11 @@ spec:
# Generate mysql server-id from pod ordinal index.
[[ `hostname` =~ -([0-9]+)$ ]] || exit 1
ordinal=${BASH_REMATCH[1]}
+ siteId={{ .Values.geoSiteId }}
echo BASH_REMATCH=${BASH_REMATCH}
echo [mysqld] > /mnt/conf.d/server-id.cnf
# Add an offset to avoid reserved server-id=0 value.
- echo server-id=$((100 + $ordinal)) >> /mnt/conf.d/server-id.cnf
+ echo server-id=$(($siteId*100 + $ordinal)) >> /mnt/conf.d/server-id.cnf
# Copy appropriate conf.d files from config-map to emptyDir.
if [[ $ordinal -eq 0 ]]; then
cp /mnt/config-map/master.cnf /mnt/conf.d/
@@ -93,7 +94,7 @@ spec:
subPath: mysql
- name: conf
mountPath: /etc/mysql/conf.d
-
+
containers:
#sdnc-db-container
- name: {{ include "common.name" . }}
@@ -236,3 +237,4 @@ spec:
#{{ else }}
emptyDir: {}
#{{ end }}
+
diff --git a/kubernetes/common/mysql/values.yaml b/kubernetes/common/mysql/values.yaml
index c0beb6fd22..43b690aa94 100644
--- a/kubernetes/common/mysql/values.yaml
+++ b/kubernetes/common/mysql/values.yaml
@@ -109,3 +109,6 @@ nfsprovisionerImage: kubernetes_incubator/nfs-provisioner:v1.0.8
nfsprovisionerPrefix: mysql
sdnctlPrefix: mysql
+
+geoEnabled: false
+geoSiteId: 1