File tree Expand file tree Collapse file tree 5 files changed +36
-8
lines changed
Expand file tree Collapse file tree 5 files changed +36
-8
lines changed Original file line number Diff line number Diff line change 44
55## v0.20.0
66* Add option to disable MongoDB and RabbitMQ in-cluster deployment and configuration (#79 )
7+ * Compose multi-node connection string for MongoDB cluster instead of using loadbalancer single host (#80 )
78
89## v0.19.0
910* Configure RabbitMQ Queue mirroring by default, see https://www.rabbitmq.com/ha.html (#78 )
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ apiVersion: v1
22# Update StackStorm version here to rely on other Docker images tags
33appVersion : 3.2dev
44name : stackstorm-ha
5- version : 0.19 .0
5+ version : 0.20 .0
66description : StackStorm K8s Helm Chart, optimized for running StackStorm in HA environment.
77home : https://stackstorm.com/#product
88icon : https://avatars1.githubusercontent.com/u/4969009
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ dependencies:
44 repository : https://kubernetes-charts.storage.googleapis.com/
55 condition : rabbitmq-ha.enabled
66 - name : mongodb-replicaset
7- version : 3.9.2
7+ version : 3.9.6
88 repository : https://kubernetes-charts.storage.googleapis.com/
99 alias : mongodb-ha
1010 condition : mongodb-ha.enabled
Original file line number Diff line number Diff line change @@ -32,3 +32,28 @@ stackstorm
3232{ {- define " hyphenPrefix" -} }
3333{ { if . } }-{ { . } }{ {end} }
3434{ {- end -} }
35+
36+ # Allow calling helpers from nested sub-chart
37+ # https://stackoverflow.com/a/52024583/4533625
38+ # https://github.com/helm/helm/issues/4535#issuecomment-477778391
39+ # Usage: "{ { include " nested" (list . " mongodb-ha" " mongodb-replicaset.fullname" ) } }"
40+ { {- define " nested" } }
41+ { {- $dot := index . 0 } }
42+ { {- $subchart := index . 1 | splitList " ." } }
43+ { {- $template := index . 2 } }
44+ { {- $values := $dot .Values } }
45+ { {- range $subchart } }
46+ { {- $values = index $values . } }
47+ { {- end } }
48+ { {- include $template (dict " Chart" (dict " Name" (last $subchart )) " Values" $values " Release" $dot .Release " Capabilities" $dot .Capabilities) } }
49+ { {- end } }
50+
51+ # Generate comma-separated list of nodes for MongoDB-HA connection string, based on number of replicas and service name
52+ { {- define " mongodb-ha-nodes" -} }
53+ { {- $replicas := (int (index .Values " mongodb-ha" " replicas" )) } }
54+ { {- $mongo_fullname := include " nested" (list $ " mongodb-ha" " mongodb-replicaset.fullname" ) } }
55+ { {- range $index0 := until $replicas -} }
56+ { {- $index1 := $index0 | add1 -} }
57+ { { $mongo_fullname } }-{ { $index0 } }.{ { $mongo_fullname } }{ { if ne $index1 $replicas } },{ { end } }
58+ { {- end -} }
59+ { {- end -} }
Original file line number Diff line number Diff line change @@ -22,18 +22,20 @@ data:
2222 api_url = http://{{ .Release.Name }}-st2api{{ template "enterpriseSuffix" . }}:9101/
2323 [coordination]
2424 url = etcd://{{ .Release.Name }}-etcd:2379
25- [messaging]
2625 {{- if index .Values "rabbitmq-ha" "enabled" }}
26+ [messaging]
2727 url = amqp://{{ required "rabbitmq-ha.rabbitmqUsername is required!" (index .Values "rabbitmq-ha" "rabbitmqUsername") }}:{{ required "rabbitmq-ha.rabbitmqPassword is required!" (index .Values "rabbitmq-ha" "rabbitmqPassword") }}@{{ .Release.Name }}-rabbitmq-ha-discovery:5672
2828 {{- end }}
29- [database]
3029 {{- if index .Values "mongodb-ha" "enabled" }}
31- # TODO: ReplicaSet connection string needs templating based on number of MongoDB nodes
30+ [database]
3231 {{- if index .Values "mongodb-ha" "auth" "enabled" }}
33- host = mongodb://{{ required "mongodb-ha.auth.adminUser is required!" (index .Values "mongodb-ha" "auth" "adminUser") }}:{{ required "mongodb-ha.auth.adminPassword is required!" (index .Values "mongodb-ha" "auth" "adminPassword") }}@{{ .Release.Name }}-mongodb-ha/?authSource=admin&replicaSet=rs0
34- {{ else }}
35- host = mongodb://{{ .Release.Name }}-mongodb-ha/?replicaSet=rs0
32+ host = mongodb://{{ template "mongodb-ha-nodes" $ }}/?authSource=admin&replicaSet={{ index .Values "mongodb-ha" "replicaSetName" }}
33+ username = {{ required "mongodb-ha.auth.adminUser is required!" (index .Values "mongodb-ha" "auth" "adminUser") }}
34+ password = {{ required "mongodb-ha.auth.adminPassword is required!" (index .Values "mongodb-ha" "auth" "adminPassword") }}
35+ {{- else }}
36+ host = mongodb://{{ template "mongodb-ha-nodes" $ }}/?replicaSet={{ index .Values "mongodb-ha" "replicaSetName" }}
3637 {{- end }}
38+ port = {{ index .Values "mongodb-ha" "port" }}
3739 {{- end }}
3840
3941 # User-defined st2 config with custom settings applied on top of everything else.
You can’t perform that action at this time.
0 commit comments