diff options
author | Mike Elliott <mike.elliott@amdocs.com> | 2018-04-05 01:07:40 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-04-05 01:07:40 +0000 |
commit | 4624c12f60bf3d469d2008122902df8d5410952d (patch) | |
tree | 766573d1cb0a77501ffea955a33b82ee38dcf5e3 /kubernetes/common/mysql/templates | |
parent | ad6382f57e802ced0892ea103bf880e11050590b (diff) | |
parent | baadb38f90168c15b9fc6007b507269ff5c47551 (diff) |
Merge "Multi-site High-availability Manual Failover (PoC)"
Diffstat (limited to 'kubernetes/common/mysql/templates')
-rw-r--r-- | kubernetes/common/mysql/templates/service.yaml | 24 | ||||
-rw-r--r-- | kubernetes/common/mysql/templates/statefulset.yaml | 6 |
2 files changed, 28 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 }} + |