From 8dbe485cfcbbeeaad58f8d934bb971105e1b0d10 Mon Sep 17 00:00:00 2001 From: Simon Flandergan Date: Sun, 11 Aug 2019 23:27:02 +0200 Subject: [PATCH] allow disabling slave replication --- activemq-artemis/templates/configmap.yaml | 21 ++++++++++++------- .../templates/master-statefulset.yaml | 4 +++- .../templates/slave-statefulset.yaml | 6 +++++- activemq-artemis/values.yaml | 2 ++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/activemq-artemis/templates/configmap.yaml b/activemq-artemis/templates/configmap.yaml index e1839ff..e9718b0 100644 --- a/activemq-artemis/templates/configmap.yaml +++ b/activemq-artemis/templates/configmap.yaml @@ -18,12 +18,17 @@ data: {{- $releaseName := printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- $releaseNamespace := .Release.Namespace -}} + {{- $connectorTypes := dict "master" "" }} + {{- if .Values.slaveReplication }} + {{- $_ := set $connectorTypes "slave" "" }} + {{- end }} + - {{ range $i,$t := until (int .Values.replicas) }} - {{ range tuple "master" "slave" }} + {{- range $i,$t := until (int .Values.replicas) }} + {{- range tuple "master" "slave" }} tcp://{{ $fullname }}-{{ . }}-{{ $i }}.{{ $releaseName }}-{{ . }}.{{ $releaseNamespace }}.svc.cluster.local:61616 - {{ end }} - {{end}} + {{- end }} + {{- end}} @@ -41,11 +46,11 @@ data: 1 - {{ range $i,$t := until (int .Values.replicas) }} - {{ range tuple "master" "slave" }} + {{- range $i,$t := until (int .Values.replicas) }} + {{- range (keys $connectorTypes) }} {{ $fullname }}-{{ . }}-{{ $i }} - {{ end }} - {{ end }} + {{- end }} + {{- end }} diff --git a/activemq-artemis/templates/master-statefulset.yaml b/activemq-artemis/templates/master-statefulset.yaml index 14db001..4b91ccc 100644 --- a/activemq-artemis/templates/master-statefulset.yaml +++ b/activemq-artemis/templates/master-statefulset.yaml @@ -64,7 +64,7 @@ spec: containers: - name: {{ include "artemis.fullname" . }} image: {{ template "artemis.image" . }} - imagePullPolicy: {{ .Values.image.imagePullPolicy | quote }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} resources: {{ toYaml .Values.resources | indent 10 }} env: @@ -122,7 +122,9 @@ spec: name: data spec: accessModes: [ {{ .Values.persistence.accessMode | quote }} ] + {{- if .Values.persistence.storageClass }} storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} resources: requests: storage: {{ .Values.persistence.size }} diff --git a/activemq-artemis/templates/slave-statefulset.yaml b/activemq-artemis/templates/slave-statefulset.yaml index d6af3b6..ffeda71 100644 --- a/activemq-artemis/templates/slave-statefulset.yaml +++ b/activemq-artemis/templates/slave-statefulset.yaml @@ -1,3 +1,4 @@ +{{- if .Values.slaveReplication }} apiVersion: apps/v1 kind: StatefulSet metadata: @@ -102,11 +103,14 @@ spec: name: data spec: accessModes: [ {{ .Values.persistence.accessMode | quote }} ] + {{- if .Values.persistence.storageClass }} storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} resources: requests: storage: {{ .Values.persistence.size }} {{- else}} - name: data emptyDir: {} -{{- end}} +{{- end }} +{{- end }} diff --git a/activemq-artemis/values.yaml b/activemq-artemis/values.yaml index df93a3f..7f61d39 100644 --- a/activemq-artemis/values.yaml +++ b/activemq-artemis/values.yaml @@ -18,6 +18,8 @@ artemisUser: artemis artemisPassword: simetraehcapa replicas: 2 +# slaveReplication: start backup brokers for failover +slaveReplication: true # antiAffinity sets an anti affinity policy between masters and slaves as either hard or soft, default is hard antiAffinity: "soft"