From 5bcfb92124195ec28c2ebd574737c4199d776ba1 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Tue, 5 Dec 2023 17:35:15 +0100
Subject: [PATCH] staging: Deploy counter journal clients service

Refs. swh/infra/sysadm-environment#5179
---
 swh/values/default.yaml               | 22 ++++++++++++++++++++++
 swh/values/staging/default.yaml       | 16 ++++++++++++++++
 swh/values/staging/swh-cassandra.yaml |  7 +++++++
 3 files changed, 45 insertions(+)

diff --git a/swh/values/default.yaml b/swh/values/default.yaml
index bc6d5e9f5..eaaa71bc9 100644
--- a/swh/values/default.yaml
+++ b/swh/values/default.yaml
@@ -290,3 +290,25 @@ webhooks:
 
 statsd_exporter:
   enabled: true
+
+counters:
+  rpc:
+    affinity:
+      nodeAffinity:
+        requiredDuringSchedulingIgnoredDuringExecution:
+          nodeSelectorTerms:
+          - matchExpressions:
+            - key: swh/rpc
+              operator: In
+              values:
+              - "true"
+  journalClient:
+    affinity:
+      nodeAffinity:
+        requiredDuringSchedulingIgnoredDuringExecution:
+          nodeSelectorTerms:
+          - matchExpressions:
+            - key: swh/journal_client
+              operator: In
+              values:
+              - "true"
diff --git a/swh/values/staging/default.yaml b/swh/values/staging/default.yaml
index c19af1a5c..a5f99878b 100644
--- a/swh/values/staging/default.yaml
+++ b/swh/values/staging/default.yaml
@@ -246,6 +246,22 @@ journalClientConfiguration:
   brokersConfigurationRef: kafkaBrokers
   group_id: swh.scheduler.journal_client
 
+journalClientCountersConfiguration:
+  brokersConfigurationRef: kafkaBrokers
+  group_id: swh.counters.journal_client
+  prefix: swh.journal.objects
+  object_types:
+  - content
+  - directory
+  - origin
+  - origin_visit
+  - origin_visit_status
+  - release
+  - revision
+  - skipped_content
+  - snapshot
+  message.max.bytes: 524288000
+
 depositConfiguration:
   host: deposit-dynamic.internal.staging.swh.network
   user: ${DEPOSIT_USERNAME}
diff --git a/swh/values/staging/swh-cassandra.yaml b/swh/values/staging/swh-cassandra.yaml
index f08e03d57..885397e95 100644
--- a/swh/values/staging/swh-cassandra.yaml
+++ b/swh/values/staging/swh-cassandra.yaml
@@ -944,3 +944,10 @@ webhooks:
         group_id: swh-archive-stg-webhooks
         object_types:
           - origin_visit_status
+
+counters:
+  enabled: true
+  journalClient:
+    enabled: true
+    countersConfigurationRef: remoteCountersConfiguration
+    journalConfigurationRef: journalClientCountersConfiguration
-- 
GitLab