From a970a0d233adb9c457a9323e97f12b509513d066 Mon Sep 17 00:00:00 2001 From: Tim Campbell Date: Thu, 11 Jan 2024 15:12:51 +0100 Subject: [PATCH] Added custom volume mounts, additional small tweaks to match internal chart --- templates/deployment-sidekiq.yaml | 11 ++++- templates/deployment-streaming.yaml | 1 + templates/deployment-web.yaml | 11 ++++- values.yaml | 70 ++++++++++++++++------------- 4 files changed, 59 insertions(+), 34 deletions(-) diff --git a/templates/deployment-sidekiq.yaml b/templates/deployment-sidekiq.yaml index 9bece8f..8cae4f3 100644 --- a/templates/deployment-sidekiq.yaml +++ b/templates/deployment-sidekiq.yaml @@ -22,6 +22,7 @@ spec: type: Recreate {{- end }} replicas: {{ .replicas }} + revisionHistoryLimit: 2 selector: matchLabels: {{- include "mastodon.selectorLabels" $context | nindent 6 }} @@ -60,8 +61,8 @@ spec: topologySpreadConstraints: {{- toYaml . | nindent 8 }} {{- end }} - {{- if (not $context.Values.mastodon.s3.enabled) }} volumes: + {{- if (not $context.Values.mastodon.s3.enabled) }} - name: assets persistentVolumeClaim: claimName: {{ template "mastodon.fullname" $context }}-assets @@ -75,6 +76,9 @@ spec: configMap: name: {{ .customDatabaseConfigYml.configMapRef.name }} {{- end }} + {{- with $context.Values.volumes }} + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: {{ $context.Chart.Name }} securityContext: @@ -158,8 +162,8 @@ spec: name: {{ $context.Values.mastodon.cacheBuster.authToken.existingSecret }} key: password {{- end }} - {{- if (not $context.Values.mastodon.s3.enabled) }} volumeMounts: + {{- if (not $context.Values.mastodon.s3.enabled) }} - name: assets mountPath: /opt/mastodon/public/assets - name: system @@ -170,6 +174,9 @@ spec: mountPath: /opt/mastodon/config/database.yml subPath: {{ .customDatabaseConfigYml.configMapRef.key }} {{- end }} + {{- with $context.Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml (default (default $context.Values.resources $context.Values.mastodon.sidekiq.resources) .resources) | nindent 12 }} {{- include "mastodon.statsdExporterContainer" $ | indent 8 }} diff --git a/templates/deployment-streaming.yaml b/templates/deployment-streaming.yaml index 7ce100a..1e4acaa 100644 --- a/templates/deployment-streaming.yaml +++ b/templates/deployment-streaming.yaml @@ -10,6 +10,7 @@ metadata: {{- end }} spec: replicas: {{ .Values.mastodon.streaming.replicas }} + revisionHistoryLimit: 2 selector: matchLabels: {{- include "mastodon.selectorLabels" . | nindent 6 }} diff --git a/templates/deployment-web.yaml b/templates/deployment-web.yaml index 5bf035f..47aa0f6 100644 --- a/templates/deployment-web.yaml +++ b/templates/deployment-web.yaml @@ -10,6 +10,7 @@ metadata: {{- end }} spec: replicas: {{ .Values.mastodon.web.replicas }} + revisionHistoryLimit: 2 selector: matchLabels: {{- include "mastodon.selectorLabels" . | nindent 6 }} @@ -39,20 +40,23 @@ spec: securityContext: {{- toYaml . | nindent 8 }} {{- end }} - {{- if (not .Values.mastodon.s3.enabled) }} volumes: + {{- if (not .Values.mastodon.s3.enabled) }} - name: assets persistentVolumeClaim: claimName: {{ template "mastodon.fullname" . }}-assets - name: system persistentVolumeClaim: claimName: {{ template "mastodon.fullname" . }}-system + {{- end }} {{- include "mastodon.statsdExporterVolume" $ | indent 8 }} {{- if .Values.mastodon.web.customDatabaseConfigYml.configMapRef.name }} - name: config-database-yml configMap: name: {{ .Values.mastodon.web.customDatabaseConfigYml.configMapRef.name }} {{- end }} + {{- with .Values.volumes }} + {{- toYaml . | nindent 8 }} {{- end }} containers: - name: {{ .Chart.Name }}-web @@ -149,8 +153,8 @@ spec: name: {{ .Values.mastodon.cacheBuster.authToken.existingSecret }} key: password {{- end }} - {{- if (not .Values.mastodon.s3.enabled) }} volumeMounts: + {{- if (not .Values.mastodon.s3.enabled) }} - name: assets mountPath: /opt/mastodon/public/assets - name: system @@ -161,6 +165,9 @@ spec: mountPath: /opt/mastodon/config/database.yml subPath: {{ .Values.mastodon.web.customDatabaseConfigYml.configMapRef.key }} {{- end }} + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} ports: - name: http containerPort: {{ .Values.mastodon.web.port }} diff --git a/values.yaml b/values.yaml index b9fd707..3cdae3f 100644 --- a/values.yaml +++ b/values.yaml @@ -11,6 +11,9 @@ image: pullPolicy: IfNotPresent mastodon: + # Labels added to every Mastodon-related object + labels: {} + # -- create an initial administrator user; the password is autogenerated and will # have to be reset createAdmin: @@ -116,34 +119,35 @@ mastodon: # cpu: 250m # memory: 512Mi workers: - - name: all-queues - # -- Number of threads / parallel sidekiq jobs that are executed per Pod - concurrency: 25 - # -- Number of Pod replicas deployed by the Deployment - replicas: 1 - # -- Resources for this specific deployment to allow optimised scaling, overwrites .Values.mastodon.sidekiq.resources - resources: {} - # -- Affinity for this specific deployment, overwrites .Values.affinity and .Values.mastodon.sidekiq.affinity - affinity: {} - # -- Topology spread constraints for this specific deployment, overwrites .Values.topologySpreadConstraints and .Values.mastodon.sidekiq.topologySpreadConstraints - topologySpreadConstraints: {} - # -- Sidekiq queues for Mastodon that are handled by this worker. See https://docs.joinmastodon.org/admin/scaling/#concurrency - # See https://github.com/mperham/sidekiq/wiki/Advanced-Options#queues for how to weight queues as argument - queues: - - default,8 - - push,6 - - ingress,4 - - mailers,2 - - pull - - scheduler # Make sure the scheduler queue only exists once and with a worker that has 1 replica. - image: - repository: - tag: - # allows you to mount a custom database.yml from a configmap - customDatabaseConfigYml: - configMapRef: - name: - key: + - name: all-queues + # -- Number of threads / parallel sidekiq jobs that are executed per Pod + concurrency: 25 + # -- Number of Pod replicas deployed by the Deployment + replicas: 1 + # -- Resources for this specific deployment to allow optimised scaling, overwrites .Values.mastodon.sidekiq.resources + resources: {} + # -- Affinity for this specific deployment, overwrites .Values.affinity and .Values.mastodon.sidekiq.affinity + affinity: {} + # -- Topology spread constraints for this specific deployment, overwrites .Values.topologySpreadConstraints and .Values.mastodon.sidekiq.topologySpreadConstraints + topologySpreadConstraints: {} + # -- Sidekiq queues for Mastodon that are handled by this worker. See https://docs.joinmastodon.org/admin/scaling/#concurrency + # See https://github.com/mperham/sidekiq/wiki/Advanced-Options#queues for how to weight queues as argument + queues: + - default,8 + - push,6 + - ingress,4 + - mailers,2 + - pull + - scheduler # Make sure the scheduler queue only exists once and with a worker that has 1 replica. + image: + repository: + tag: + # allows you to mount a custom database.yml from a configmap + # please note that we do not advise using a read-only replica for sidekiq workers + customDatabaseConfigYml: + configMapRef: + name: + key: #- name: push-pull # concurrency: 50 # resources: {} @@ -166,7 +170,7 @@ mastodon: ca_file: /etc/ssl/certs/ca-certificates.crt delivery_method: smtp domain: - enable_starttls: 'auto' + enable_starttls: "auto" from_address: notifications@example.com return_path: openssl_verify_mode: peer @@ -293,7 +297,7 @@ ingress: hosts: - host: mastodon.local paths: - - path: '/' + - path: "/" tls: - secretName: mastodon-tls hosts: @@ -559,3 +563,9 @@ affinity: {} # want to spread each deployment independently, or override topologySpreadConstraints # for each deployment topologySpreadConstraints: {} + +# Default volume mounts for all pods +volumeMounts: [] + +# Default volumes for all pods +volumes: []