From fff6b842cee6c5add94f34583ca07da4b01becf9 Mon Sep 17 00:00:00 2001
From: Janne Mareike Koschinski <janne@kuschku.de>
Date: Fri, 28 Apr 2023 16:26:53 +0200
Subject: [PATCH] fix: correct issues with mastodon chart

---
 mastodon/Chart.yaml                          |  2 +-
 mastodon/templates/deployment-streaming.yaml |  1 +
 mastodon/templates/pod-tootctl.yaml          | 50 ----------------
 mastodon/templates/replicaset-tootctl.yaml   | 61 ++++++++++++++++++++
 4 files changed, 63 insertions(+), 51 deletions(-)
 delete mode 100644 mastodon/templates/pod-tootctl.yaml
 create mode 100644 mastodon/templates/replicaset-tootctl.yaml

diff --git a/mastodon/Chart.yaml b/mastodon/Chart.yaml
index 49e701a..eb6c614 100644
--- a/mastodon/Chart.yaml
+++ b/mastodon/Chart.yaml
@@ -2,5 +2,5 @@ apiVersion: v2
 name: mastodon
 description: Helm Chart for mastodon
 type: application
-version: 0.3.2
+version: 0.4.0
 appVersion: "v4.0"
diff --git a/mastodon/templates/deployment-streaming.yaml b/mastodon/templates/deployment-streaming.yaml
index f4d0541..990d5f5 100644
--- a/mastodon/templates/deployment-streaming.yaml
+++ b/mastodon/templates/deployment-streaming.yaml
@@ -48,6 +48,7 @@ spec:
               name: websocket
               protocol: TCP
           startupProbe:
+            failureThreshold: 15
             httpGet:
               port: websocket
               path: /api/v1/streaming/health
diff --git a/mastodon/templates/pod-tootctl.yaml b/mastodon/templates/pod-tootctl.yaml
deleted file mode 100644
index a8e7e53..0000000
--- a/mastodon/templates/pod-tootctl.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
-apiVersion: v1
-kind: Pod
-metadata:
-  name: {{ include "mastodon-helm.fullname" . }}-tootctl
-  labels:
-    component: tootctl
-    {{- include "mastodon-helm.labels" . | nindent 4 }}
-spec:
-  {{- with .Values.imagePullSecrets }}
-  imagePullSecrets:
-    {{- toYaml . | nindent 4 }}
-  {{- end }}
-  securityContext:
-    {{- toYaml .Values.podSecurityContext | nindent 4 }}
-  volumes:
-    - name: data
-      {{- .Values.volumes.data | nindent 6 }}
-    - name: tmp
-      emptyDir:
-        medium: Memory
-  containers:
-    - name: {{ .Chart.Name }}
-      securityContext:
-        {{- toYaml .Values.securityContext | nindent 8 }}
-      image: "{{ .Values.web.repository }}:{{ .Values.web.tag | default .Chart.AppVersion }}"
-      imagePullPolicy: {{ .Values.web.pullPolicy }}
-      command:
-        - "/bin/sh"
-        - "-c"
-        - "while true; do sleep 60; done"
-      envFrom:
-        - secretRef:
-            name: {{ include "mastodon-helm.fullname" . }}
-      volumeMounts:
-        - mountPath: "/mastodon/public/system"
-          name: data
-        - mountPath: "/opt/mastodon/tmp"
-          name: tmp
-  {{- with .Values.nodeSelector }}
-  nodeSelector:
-    {{- toYaml . | nindent 4 }}
-  {{- end }}
-  {{- with .Values.affinity }}
-  affinity:
-    {{- toYaml . | nindent 4 }}
-  {{- end }}
-  {{- with .Values.tolerations }}
-  tolerations:
-    {{- toYaml . | nindent 4 }}
-  {{- end }}
diff --git a/mastodon/templates/replicaset-tootctl.yaml b/mastodon/templates/replicaset-tootctl.yaml
new file mode 100644
index 0000000..f9544bf
--- /dev/null
+++ b/mastodon/templates/replicaset-tootctl.yaml
@@ -0,0 +1,61 @@
+apiVersion: apps/v1
+kind: ReplicaSet
+metadata:
+  name: {{ include "mastodon-helm.fullname" . }}-tootctl
+  labels:
+    component: tootctl
+    {{- include "mastodon-helm.labels" . | nindent 4 }}
+spec:
+  selector:
+    matchLabels:
+      component: tootctl
+      {{- include "mastodon-helm.labels" . | nindent 6 }}
+  template:
+    metadata:
+      name: {{ include "mastodon-helm.fullname" . }}-tootctl
+      labels:
+        component: tootctl
+        {{- include "mastodon-helm.labels" . | nindent 8 }}
+    spec:
+      {{- with .Values.imagePullSecrets }}
+      imagePullSecrets:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      securityContext:
+        {{- toYaml .Values.podSecurityContext | nindent 8 }}
+      volumes:
+        - name: data
+          {{- .Values.volumes.data | nindent 10 }}
+        - name: tmp
+          emptyDir:
+            medium: Memory
+      containers:
+        - name: {{ .Chart.Name }}
+          securityContext:
+            {{- toYaml .Values.securityContext | nindent 12 }}
+          image: "{{ .Values.web.repository }}:{{ .Values.web.tag | default .Chart.AppVersion }}"
+          imagePullPolicy: {{ .Values.web.pullPolicy }}
+          command:
+            - "/bin/sh"
+            - "-c"
+            - "while true; do sleep 60; done"
+          envFrom:
+            - secretRef:
+                name: {{ include "mastodon-helm.fullname" . }}
+          volumeMounts:
+            - mountPath: "/mastodon/public/system"
+              name: data
+            - mountPath: "/opt/mastodon/tmp"
+              name: tmp
+      {{- with .Values.nodeSelector }}
+      nodeSelector:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.affinity }}
+      affinity:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
+      {{- with .Values.tolerations }}
+      tolerations:
+        {{- toYaml . | nindent 8 }}
+      {{- end }}
-- 
GitLab