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

Add support for tolerations in all deployments and pods #95

Merged
merged 4 commits into from
May 8, 2024
Merged
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
18 changes: 18 additions & 0 deletions rocketchat/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,21 @@ Usage:
{{- printf "mongodb://%s:%s@%s:%0.f/local?replicaSet=%s&authSource=admin" $user $password $service $port $rs }}
{{- end }}
{{- end }}

{{/* Get correct tolerations */}}
{{- define "rocketchat.tolerations" -}}
{{- $name := .name -}}
{{- $tolerations := list -}}
{{- with .context }}
{{- if eq $name "meteor" }}
{{ $tolerations = .Values.tolerations }}
{{- else }}
{{ $tolerations = get (get .Values.microservices $name) "tolerations" }}
{{- end }}
{{- if (and (kindIs "slice" $tolerations) (gt (len $tolerations) 0)) }}
{{- toYaml $tolerations }}
{{- else }}
{{- toYaml .Values.global.tolerations }}
{{- end }}
{{- end }}
{{- end -}}
2 changes: 2 additions & 0 deletions rocketchat/templates/chat-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ spec:
{{- if .Values.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 6 }}
{{- end }}
tolerations:
{{ include "rocketchat.tolerations" (dict "name" "meteor" "context" $) | indent 8 }}
{{- if or .Values.podAntiAffinity .Values.affinity }}
affinity:
{{- if .Values.affinity }}
Expand Down
5 changes: 5 additions & 0 deletions rocketchat/templates/hook-verify-mongodb-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ spec:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
restartPolicy: OnFailure
{{- if $.Values.tolerations }}
tolerations:
{{ toYaml $.Values.tolerations | indent 8 }}
{{- end }}

containers:
- name: '{{ include "rocketchat.fullname" . }}-pre-upgrade'
{{- $registry := .Values.mongodb.image.registry }}
Expand Down
2 changes: 2 additions & 0 deletions rocketchat/templates/microservices-account-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ spec:
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
spec:
tolerations:
{{ include "rocketchat.tolerations" (dict "name" "account" "context" $) | indent 8 }}
containers:
- name: account-service
image: "{{ .Values.microservices.account.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spec:
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
spec:
tolerations:
{{ include "rocketchat.tolerations" (dict "name" "authorization" "context" $) | indent 8 }}
containers:
- name: authorization-service
image: "{{ .Values.microservices.authorization.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ spec:
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
spec:
tolerations:
{{ include "rocketchat.tolerations" (dict "name" "ddpStreamer" "context" $) | indent 8 }}
containers:
- name: ddp-streamer
image: "{{ .Values.microservices.ddpStreamer.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down
2 changes: 2 additions & 0 deletions rocketchat/templates/microservices-presence-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spec:
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
spec:
tolerations:
{{ include "rocketchat.tolerations" (dict "name" "presence" "context" $) | indent 8 }}
containers:
- name: presence-service
image: "{{ .Values.microservices.presence.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down
2 changes: 2 additions & 0 deletions rocketchat/templates/microservices-stream-hub-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spec:
{{- toYaml .Values.podLabels | nindent 8 }}
{{- end }}
spec:
tolerations:
{{ include "rocketchat.tolerations" (dict "name" "streamHub" "context" $) | indent 8 }}
containers:
- name: stream-hub
image: "{{ .Values.microservices.streamHub.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down
30 changes: 30 additions & 0 deletions rocketchat/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## common configuration across all deployments
global:
# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
tolerations: []

## Rocket Chat image version
## ref: https://hub.docker.com/r/rocketchat/rocket.chat/tags
##
Expand Down Expand Up @@ -297,34 +303,54 @@ microservices:
pullPolicy: IfNotPresent
securityContext: {}
resources: {}
# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
tolerations: []

ddpStreamer:
replicas: 1
image:
repository: rocketchat/ddp-streamer-service
pullPolicy: IfNotPresent
securityContext: {}
resources: {}
# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
tolerations: []

account:
replicas: 1
image:
repository: rocketchat/account-service
pullPolicy: IfNotPresent
securityContext: {}
resources: {}
# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
tolerations: []

authorization:
replicas: 1
image:
repository: rocketchat/authorization-service
pullPolicy: IfNotPresent
securityContext: {}
resources: {}
# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
tolerations: []

streamHub:
replicas: 1
image:
repository: rocketchat/stream-hub-service
pullPolicy: IfNotPresent
securityContext: {}
resources: {}
# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
tolerations: []

nats:
replicas: 1

Expand Down Expand Up @@ -366,3 +392,7 @@ postgresql:
extraEnvVars:
- name: POSTGRES_INITDB_ARGS
value: "--lc-collate=C --lc-ctype=C"

# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
tolerations: []