From d95f954604350f59e60116c5dddd77ae8e7a79de Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Tue, 17 Oct 2023 18:24:45 +0200
Subject: [PATCH] web: Drop indirection in storage remote configuration for
 webapp

Refs. swh/infra/sysadm-environment#5095
---
 swh/templates/web/configmap.yaml         |  4 +++-
 swh/values/production/swh-cassandra.yaml |  6 +++++-
 swh/values/staging/default.yaml          | 13 -------------
 swh/values/staging/swh-cassandra.yaml    | 18 +++++++++++++++++-
 swh/values/staging/swh.yaml              |  1 +
 5 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/swh/templates/web/configmap.yaml b/swh/templates/web/configmap.yaml
index fc358906e..b9448836a 100644
--- a/swh/templates/web/configmap.yaml
+++ b/swh/templates/web/configmap.yaml
@@ -7,7 +7,9 @@ metadata:
   name: web-configuration-template
 data:
   config.yml.template: |
-    {{- include "swh.storageConfiguration" (list .Values . .Values.web.storageConfigurationRef) | nindent 4 }}
+    {{- include "swh.service.fromYaml" (dict "service" "storage"
+                                             "configurationRef" .Values.web.storageConfigurationRef
+                                             "Values" .Values) | nindent 4 }}
     {{- if .Values.web.searchConfigurationRef }}
       {{- include "swh.service.fromYaml" (dict "service" "search" "configurationRef" .Values.web.searchConfigurationRef "Values" .Values) | nindent 4 }}
     {{- end -}}
diff --git a/swh/values/production/swh-cassandra.yaml b/swh/values/production/swh-cassandra.yaml
index 5766140c2..27cdc1b8d 100644
--- a/swh/values/production/swh-cassandra.yaml
+++ b/swh/values/production/swh-cassandra.yaml
@@ -47,6 +47,10 @@ localRpcROStorageService:
 localRpcROStorageConfiguration:
   storageConfigurationRef: localRpcROStorageService
 
+remoteStorageConfiguration:
+  cls: remote
+  host: http://storage:5002
+
 storage_replayer:
   enabled: true
 
@@ -277,7 +281,7 @@ web:
   databaseConfigurationRef: postgresqlWebConfiguration
   searchConfigurationRef: remoteSearchConfiguration
   schedulerConfigurationRef: remoteSchedulerConfiguration
-  storageConfigurationRef: localRpcROStorageConfiguration
+  storageConfigurationRef: remoteStorageConfiguration
   vaultConfigurationRef: remoteVaultConfiguration
   indexerStorageConfigurationRef: remoteIndexerStorageConfiguration
   countersConfigurationRef: remoteCountersConfiguration
diff --git a/swh/values/staging/default.yaml b/swh/values/staging/default.yaml
index 167ed8ee3..54db15a1f 100644
--- a/swh/values/staging/default.yaml
+++ b/swh/values/staging/default.yaml
@@ -192,19 +192,6 @@ journalWriterConfiguration:
   producer_config:
     message.max.bytes: 1000000000
 
-
-localRpcRWStorageConfiguration:
-  cls: remote
-  host: http://storage:5002
-
-rpcRWStorageConfiguration:
-  pipelineStepsRef: storagePipelineSteps
-  storageConfigurationRef: localRpcRWStorageConfiguration
-
-# (Not so) readonly (namespace local) storage
-localRpcROStorageConfiguration:
-  storageConfigurationRef: localRpcRWStorageConfiguration
-
 webThrottling:
   internalExemptedNetworkRangesRef: stagingNetworkRanges
   cache_uri: memcached:11211
diff --git a/swh/values/staging/swh-cassandra.yaml b/swh/values/staging/swh-cassandra.yaml
index bee733d8a..6e52cc49b 100644
--- a/swh/values/staging/swh-cassandra.yaml
+++ b/swh/values/staging/swh-cassandra.yaml
@@ -1,5 +1,21 @@
 namespace: swh-cassandra
 
+remoteStorageConfiguration:
+  cls: remote
+  host: http://storage:5002
+
+localRpcRWStorageConfiguration:
+  cls: remote
+  host: http://storage:5002
+
+rpcRWStorageConfiguration:
+  pipelineStepsRef: storagePipelineSteps
+  storageConfigurationRef: localRpcRWStorageConfiguration
+
+# (Not so) readonly (namespace local) storage
+localRpcROStorageConfiguration:
+  storageConfigurationRef: localRpcRWStorageConfiguration
+
 cassandraSeeds:
   - cassandra1.internal.staging.swh.network
   - cassandra2.internal.staging.swh.network
@@ -540,7 +556,7 @@ web:
   databaseConfigurationRef: postgresqlWebConfiguration
   searchConfigurationRef: remoteSearchConfiguration
   schedulerConfigurationRef: remoteSchedulerConfiguration
-  storageConfigurationRef: localRpcROStorageConfiguration
+  storageConfigurationRef: remoteStorageConfiguration
   vaultConfigurationRef: remoteVaultConfiguration
   indexerStorageConfigurationRef: remoteIndexerStorageConfiguration
   countersConfigurationRef: remoteCountersConfiguration
diff --git a/swh/values/staging/swh.yaml b/swh/values/staging/swh.yaml
index 0b7b4fb71..654fe4657 100644
--- a/swh/values/staging/swh.yaml
+++ b/swh/values/staging/swh.yaml
@@ -1,4 +1,5 @@
 
+
 remoteStorageConfiguration:
   cls: remote
   url: http://storage1.internal.staging.swh.network:5002
-- 
GitLab