From 3cf28a23f6b92f9bbb25bddd250e3f714957f106 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Tue, 15 Nov 2022 04:50:49 +0100
Subject: [PATCH] fix(mastodon): Add automatic detection of scheduler sidekiq

This patch adjusts the helm chart to automatically to
automatically switch to strategy `Recreate` when deploying the
scheduler queue to a sidekiq container. This will prevent
accidental concurrent execution of it.
---
 charts/mastodon/Chart.yaml                        | 2 +-
 charts/mastodon/README.md                         | 2 +-
 charts/mastodon/templates/deployment-sidekiq.yaml | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/charts/mastodon/Chart.yaml b/charts/mastodon/Chart.yaml
index 178761466..b442f0fc6 100644
--- a/charts/mastodon/Chart.yaml
+++ b/charts/mastodon/Chart.yaml
@@ -15,7 +15,7 @@ type: application
 # This is the chart version. This version number should be incremented each time you make changes
 # to the chart and its templates, including the app version.
 # Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 3.0.0
+version: 3.0.1
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
diff --git a/charts/mastodon/README.md b/charts/mastodon/README.md
index b05874aa2..f1a06c4f8 100644
--- a/charts/mastodon/README.md
+++ b/charts/mastodon/README.md
@@ -1,6 +1,6 @@
 # mastodon
 
-![Version: 3.0.0](https://img.shields.io/badge/Version-3.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v3.5.3](https://img.shields.io/badge/AppVersion-v3.5.3-informational?style=flat-square)
+![Version: 3.0.1](https://img.shields.io/badge/Version-3.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v3.5.3](https://img.shields.io/badge/AppVersion-v3.5.3-informational?style=flat-square)
 
 Mastodon is a free, open-source social network server based on ActivityPub.
 
diff --git a/charts/mastodon/templates/deployment-sidekiq.yaml b/charts/mastodon/templates/deployment-sidekiq.yaml
index 623c55025..9eebb4016 100644
--- a/charts/mastodon/templates/deployment-sidekiq.yaml
+++ b/charts/mastodon/templates/deployment-sidekiq.yaml
@@ -10,6 +10,10 @@ metadata:
     app.kubernetes.io/part-of: rails
 spec:
   replicas: {{ .replicas }}
+  {{- if (has "scheduler" .queues) }}
+  strategy:
+    type: Recreate
+  {{- end }}
   selector:
     matchLabels:
       {{- include "mastodon.selectorLabels" $context | nindent 6 }}
-- 
GitLab