From 3f42c761b4689530bcca9a9972bdeb3c26a481b6 Mon Sep 17 00:00:00 2001
From: Guillaume Samson <guillaume.samson@softwareheritage.org>
Date: Thu, 25 May 2023 16:06:26 +0200
Subject: [PATCH] swh/storage: update configmap for journal access

---
 swh/templates/storage/configmap.yaml | 14 ++++++++++++++
 swh/values.yaml                      | 16 ++++++++++++++++
 swh/values/staging-cassandra.yaml    |  7 +++++++
 3 files changed, 37 insertions(+)

diff --git a/swh/templates/storage/configmap.yaml b/swh/templates/storage/configmap.yaml
index feec9775c..b79a55e19 100644
--- a/swh/templates/storage/configmap.yaml
+++ b/swh/templates/storage/configmap.yaml
@@ -32,4 +32,18 @@ data:
         objstorages:
         {{ .Values.storage.objstorageConfig }}
       {{- end }}
+      {{- if .Values.storage.journalWriter }}
+        {{- with .Values.storage.journalWriter }}
+      journal_writer:
+        cls: kafka
+        brokers:
+          {{- range $broker := .brokers }}
+          - {{ $broker }}
+          {{- end}}
+        prefix: {{ .prefix | default "swh.journal.objects" }}
+        client_id: {{ .clientId }}
+        anonymize: {{ .anonymize | default true }}
+        producer_config: {{ .producerConfig | nindent 10 }}
+        {{- end }}
+      {{- end }}
 {{- end -}}
diff --git a/swh/values.yaml b/swh/values.yaml
index d1e101fc8..62b4b1e32 100644
--- a/swh/values.yaml
+++ b/swh/values.yaml
@@ -245,6 +245,22 @@ storage:
     # the hostname on which the storage must be reachable
     # host: mystorage.localdomain
 
+  ## if journal access is required
+  ## mandatory values
+  #journalWriter:
+  #  brokers:
+  #    - kafka1
+  #    - kafka2
+  #    - kafka3
+  #  clientId: swh.storage.journal_writer.storage1
+  #  producerConfig: |-
+  #    message.max.bytes: 1000000000
+  #    item2: value2
+  #    item3: value3
+  ## optional values with their default value
+  #  prefix: swh.journal.objects
+  #  anonymize: true
+
 web:
   enabled: false
   logLevel: INFO
diff --git a/swh/values/staging-cassandra.yaml b/swh/values/staging-cassandra.yaml
index edbf47133..b08727ebd 100644
--- a/swh/values/staging-cassandra.yaml
+++ b/swh/values/staging-cassandra.yaml
@@ -199,6 +199,13 @@ storage:
   gunicorn:
     threads: 4
     workers: 8
+  #journalWriter:
+  #  brokers:
+  #    - journal1.internal.staging.swh.network
+  #    - journal2.internal.staging.swh.network
+  #  clientId: swh.storage.journal_writer.storage
+  #  producerConfig: |-
+  #    message.max.bytes: 1000000000
 
 web:
   enabled: true
-- 
GitLab