Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using IP addresses for clustering and support Deployment #26

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions MongooseIM/templates/mongoose-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{{ if eq .Values.workloadAPI "Deployment" -}}
{{ $mnesia_enabled := or (eq .Values.volatileDatabase "mnesia") (eq .Values.persistentDatabase "mnesia") -}}
{{ if $mnesia_enabled -}}
{{ required "Deployment does not support Mnesia" "" -}}
{{ end -}}

apiVersion: apps/v1
kind: Deployment
metadata:
name: mongooseim
namespace:
labels:
app: mongooseim
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: mongooseim
template:
metadata:
labels:
app: mongooseim
annotations:
rollout: {{ .Values.rolloutId | default (randAlphaNum 24) }}
spec:
subdomain: mongooseim
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
containers:
- name: mongooseim
image: {{ .Values.image.repository }}:{{or .Values.image.tag .Chart.AppVersion}}
env:
- name: JOIN_CLUSTER
value: "false"
- name: NODE_TYPE
value: "name"
- name: NODE_NAME
value: {{ .Values.nodeName }}
- name: NODE_HOST
valueFrom:
fieldRef:
fieldPath: status.podIP
ports:
- name: epmd
containerPort: 4369
- name: c2s
containerPort: 5222
- name: s2s
containerPort: 5269
- name: bosh-ws
containerPort: 5280
- name: bosh-wss
containerPort: 5285
- name: erlang-dist
containerPort: 9100
- name: gql-admin
containerPort: 5551
- name: gql-dom-admin
containerPort: 5541
- name: gql-user
containerPort: 5561
readinessProbe:
tcpSocket:
port: c2s
initialDelaySeconds: 10
periodSeconds: 10
volumeMounts:
- name: config-map
mountPath: /member
{{- if .Values.tlsCertSecret }}
- name: tls
mountPath: /usr/lib/mongooseim/priv/ssl
readOnly: true
{{- end }}
volumes:
- name: config-map
configMap:
name: mongooseim
{{- if .Values.tlsCertSecret }}
- name: tls
secret:
secretName: {{ .Values.tlsCertSecret }}
{{- end }}
setHostnameAsFQDN: true
{{ end }}
8 changes: 8 additions & 0 deletions MongooseIM/templates/mongoose-sts.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if eq .Values.workloadAPI "StatefulSet" -}}
{{ $mnesia_enabled := or (eq .Values.volatileDatabase "mnesia") (eq .Values.persistentDatabase "mnesia") -}}

apiVersion: apps/v1
Expand Down Expand Up @@ -42,6 +43,12 @@ spec:
value: "name"
- name: NODE_NAME
value: {{ .Values.nodeName }}
{{- if .Values.skipClusterDNS }}
- name: NODE_HOST
valueFrom:
fieldRef:
fieldPath: status.podIP
{{- end }}
ports:
- name: epmd
containerPort: 4369
Expand Down Expand Up @@ -97,3 +104,4 @@ spec:
requests:
storage: 1Gi
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions MongooseIM/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ mimConfig: ""
rolloutId: ""
tlsCertSecret: {}

workloadAPI: "StatefulSet"
skipClusterDNS: false

volatileDatabase: "mnesia"
persistentDatabase: "mnesia"

Expand Down