From 53bac30d4627d62d9f061d0141d5dd606ebde8ed Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Fri, 24 Mar 2023 14:49:46 +0100
Subject: [PATCH] Add redis configuration to storage replayer configmap

Refs. swh/infra/sysadm-environment#4809
---
 swh/templates/storage-replayer/configmap.yaml | 8 ++++++++
 swh/values.yaml                               | 7 +++++++
 swh/values/staging-cassandra.yaml             | 4 ++++
 3 files changed, 19 insertions(+)

diff --git a/swh/templates/storage-replayer/configmap.yaml b/swh/templates/storage-replayer/configmap.yaml
index 8cc2eb8a5..37ae527bf 100644
--- a/swh/templates/storage-replayer/configmap.yaml
+++ b/swh/templates/storage-replayer/configmap.yaml
@@ -1,4 +1,5 @@
 {{ if .Values.storage_replayer.enabled -}}
+{{- $error_reporter := .Values.storage_replayer.error_reporter }}
 {{- range $deployment, $deployment_config := .Values.storage_replayer.deployments -}}
 ---
 apiVersion: v1
@@ -43,5 +44,12 @@ data:
       {{- range $object := get $deployment_config "objects" }}
         - {{ $object }}
       {{- end }}
+    {{- if $error_reporter }}
+    replayer:
+      error_reporter:
+      {{- range $option, $value := $error_reporter }}
+        {{ $option }}: {{ $value }}
+      {{- end }}
+    {{- end }}
 {{ end }}
 {{- end -}}
diff --git a/swh/values.yaml b/swh/values.yaml
index d9f41df16..fe4b7be0a 100644
--- a/swh/values.yaml
+++ b/swh/values.yaml
@@ -83,6 +83,13 @@ storage_replayer:
     - seed2
     keySpace: swh
     consistencyLevel: LOCAL_QUORUM
+  # optional 'replayer' configuration may be specified with a 'error_reporter' config
+  # entry allowing to specify redis connection parameters. It will be used to report
+  # non-recoverable replaying issues
+  # error_reporter:
+  #   host: redis.redis
+  #   port: 6379
+  #   db: 1
   deployments:
   # Example of deployments
   #   origins:
diff --git a/swh/values/staging-cassandra.yaml b/swh/values/staging-cassandra.yaml
index 19ff4b741..687b01aea 100644
--- a/swh/values/staging-cassandra.yaml
+++ b/swh/values/staging-cassandra.yaml
@@ -25,6 +25,10 @@ storage_replayer:
       - cassandra1.internal.staging.swh.network
       - cassandra2.internal.staging.swh.network
       - cassandra3.internal.staging.swh.network
+  error_reporter:
+    host: redis.redis
+    port: 6379
+    db: 1
   deployments:
     content:
       objects:
-- 
GitLab