From f744ecae341c87adfe838cac7df709ed12400d4f Mon Sep 17 00:00:00 2001
From: Pablo Vigo <pvigo@collabora.com>
Date: Wed, 11 Oct 2023 12:31:03 +0200
Subject: [PATCH] Ensure pod restarts upon object update

Annotate objects with a hashsum of a part of the object. This ensures
the pod restarts automatically whenever the secret or the configuration
is updated.

Signed-off-by: Pablo Vigo <pvigo@collabora.com>
---
 aptly-chart/templates/statefulset.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/aptly-chart/templates/statefulset.yaml b/aptly-chart/templates/statefulset.yaml
index d126e59..11ee3df 100644
--- a/aptly-chart/templates/statefulset.yaml
+++ b/aptly-chart/templates/statefulset.yaml
@@ -18,6 +18,9 @@ spec:
       {{- with .Values.podAnnotations }}
       annotations:
         {{- toYaml . | nindent 8 }}
+        checksum/{{ include "aptly.configSecretName" . }}: {{ include (print $.Template.BasePath "/secret-config.yaml") . | sha256sum }}
+        checksum/{{ include "aptly.gpgSecretName" . }}: {{ include (print $.Template.BasePath "/secret-gpg.yaml") . | sha256sum }}
+        checksum/config: {{ include (print $.Template.BasePath "/configmap-publish.yaml") . | sha256sum }}
       {{- end }}
       labels:
         {{- include "aptly.selectorLabels" . | nindent 8 }}
-- 
GitLab