Skip to content

cassandra: Make init-keyspace.py work with pipeline storage config

Antoine R. Dumont requested to merge fix-init-keyspace into staging

It currently fails to start the new version with the pipeline (with the blocking proxy).

Tested in a cassandra pod to ensure the parsing is ok. It is.

This will now raise if the configuration is wrong or incomplete with a proper error message:

swh@storage-cassandra-7655859488-tnzfw:~$ python init-keyspace.py 2>&1  | tail -1
ValueError: Misconfigured pipeline, the last step must be the actualcassandra storage configuration.
swh@storage-cassandra-7655859488-tnzfw:~$ python init-keyspace.py 2>&1  | tail -1
ValueError: Misconfigured pipeline, the last step must be the actual cassandra storage configuration.
swh@storage-cassandra-7655859488-tnzfw:~$ python init-keyspace.py 2>&1  | tail -1
ValueError: Misconfigured storage configuration. It must be either a <pipeline> or a <cassandra> storage instance.
swh@storage-cassandra-7655859488-tnzfw:~$ python init-keyspace.py 2>&1  | tail -1
ValueError: Misconfigured cassandra configuration, <auth_provider> key must be provided.
swh@storage-cassandra-7655859488-tnzfw:~$ python init-keyspace.py 2>&1  | tail -1
ValueError: Misconfigured cassandra configuration, <hosts> key must be provided.
swh@storage-cassandra-7655859488-tnzfw:~$ python init-keyspace.py 2>&1  | tail -1
ValueError: Misconfigured cassandra configuration, <keyspace> key must be provided.

Note: config.yml adapted to mess things up accordingly.

helm diff
tony@kessel:~/work/swh/sysadm-environment/swh-charts (fix-init-keyspace) $ make swh-helm-diff | colordiff
colordiff 1.0.21 (http://www.colordiff.org/)
(C)2002-2022 Dave Ewart, davee@sungate.co.uk

Switched to branch 'production'
Switched to branch 'fix-init-keyspace'
Switched to branch 'production'
Switched to branch 'fix-init-keyspace'
./swh/helm-diff.sh
[swh] Comparing changes between branches production and fix-init-keyspace (per environment)...
Your branch and 'origin/production' have diverged,
and have 3 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
[swh] Generate config in production branch for environment staging, namespace swh...
[swh] Generate config in production branch for environment staging, namespace swh-cassandra...
[swh] Generate config in production branch for environment staging, namespace swh-cassandra-next-version...
[swh] Generate config in fix-init-keyspace branch for environment staging...
[swh] Generate config in fix-init-keyspace branch for environment staging...
[swh] Generate config in fix-init-keyspace branch for environment staging...
Your branch and 'origin/production' have diverged,
and have 3 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
[swh] Generate config in production branch for environment production, namespace swh...
[swh] Generate config in production branch for environment production, namespace swh-cassandra...
[swh] Generate config in production branch for environment production, namespace swh-cassandra-next-version...
[swh] Generate config in fix-init-keyspace branch for environment production...
[swh] Generate config in fix-init-keyspace branch for environment production...
[swh] Generate config in fix-init-keyspace branch for environment production...


------------- diff for environment staging namespace swh -------------

--- /tmp/swh-chart.swh.0LGEGkj9/staging-swh.before      2024-05-24 16:15:59.902485138 +0200
+++ /tmp/swh-chart.swh.0LGEGkj9/staging-swh.after       2024-05-24 16:16:00.498459862 +0200
@@ -1283,27 +1283,36 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
   name: database-utils
   namespace: swh
 data:
   init-keyspace.py: |
     from swh.core import config
     from swh.storage.cassandra import create_keyspace

-    c=config.read('/etc/swh/config.yml')
+    def get_cassandra_config(storage_config):
+      if storage_config["cls"] == 'cassandra' :
+        return storage_config

-    storage_config = c["storage"]
-    hosts = storage_config.get("hosts")
+      if storage_config["cls"] == 'pipeline':
+        for config in storage_config["steps"]:
+          c = get_cassandra_config(config)
+          if c:
+            return c

-    # print(f"************ storage_config: {storage_config}" )
-    # print(f"************ hosts: {hosts}" )
+      return None
+
+    full_config = config.read('/etc/swh/config.yml')
+    storage_config = full_config["storage"]
+    cassandra_conf = get_cassandra_config(storage_config)
+    hosts = cassandra_conf.get("hosts")

     create_keyspace(hosts=hosts, keyspace='swh', auth_provider=storage_config.get("auth_provider"))

   extract-storage-postgresql-config-py: |
     import yaml
     from swh.core import config

     def get_postgresql_config(storage_config):
       if storage_config["cls"] == 'postgresql' :
         return storage_config
@@ -12770,21 +12779,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-content
       annotations:
         checksum/config: a2b69bcb2e4886218d620cf0a718b446bdad564f2516d5e253a02ecbbf9ddbb9
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -12898,21 +12907,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-directory
       annotations:
         checksum/config: b1d8818071de20b81471f28c01abdfca26910e76e6ad22c0634e6c618ddd1ce1
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13026,21 +13035,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-extid
       annotations:
         checksum/config: 6c84cef8e9a1c60038f3d52c8a2524a87610395d9124d29739af2d4657c934c9
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13154,21 +13163,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-metadata
       annotations:
         checksum/config: ce7349e79b8d1f652b1a1b6098b865ffdeaa786159f4a4a7cc0ccb06c86b30ac
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13282,21 +13291,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin
       annotations:
         checksum/config: 7be85457aa9968f72d3c3e33628363f1dc4be9370d5cbaaeb8b4b28d60b7cb7d
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13410,21 +13419,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin-visit
       annotations:
         checksum/config: fd3c0bfbd2a4cc07b35f44d96c73d3942ed2fa65fd86de844d83f8b7edcc8552
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13538,21 +13547,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin-visit-status
       annotations:
         checksum/config: 0cb1e73d6ed1459db0fe2bfcd1b65773a8756841823512bbc808ad38fb18d763
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13666,21 +13675,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-raw-extrinsic-metadata
       annotations:
         checksum/config: cbca07718838a97b195a4781b10a94c41089ae5e971b2544b6c30ff1246b2d56
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13794,21 +13803,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-release
       annotations:
         checksum/config: bf61bed6dc4305a5a43487167ef48c5596b744f59be33ae413c4695704133ff4
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13922,21 +13931,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-revision
       annotations:
         checksum/config: dc5a3440403381c73e6879bbc397e31289041e7991f5cf5de3cf161d3a5809e9
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -14050,21 +14059,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-skipped-content
       annotations:
         checksum/config: 0f92a957f2bd89e84e7a82face84b7b50bb78cf0f1bc2ef4333e8de93856d275
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -14178,21 +14187,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-snapshot
       annotations:
         checksum/config: ce664a5d7644332e964939de75e45252a5d031d623db536504a49314a2a1dc85
-        checksum/config_utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/config_utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -14306,21 +14315,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-postgresql-read-only
       annotations:
         checksum/config: 6af52166b9f1e49fbd071779062391bfced2a4756536ec9f022d05a49175b758
-        checksum/database-utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/database-utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
         checksum/config-utils: d75ca13b805bce6a8ab59c8e24c938f2283108f6a79134f6e71db86308651dc6
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/storage
                 operator: In
                 values:
@@ -14457,21 +14466,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-postgresql-read-write
       annotations:
         checksum/config: d2863939aa44dcbffca26e7e5a44d9de374f971676ef18aba35f7dcce2313f1b
-        checksum/database-utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/database-utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
         checksum/config-utils: d75ca13b805bce6a8ab59c8e24c938f2283108f6a79134f6e71db86308651dc6
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/storage
                 operator: In
                 values:


------------- diff for environment staging namespace swh-cassandra -------------

--- /tmp/swh-chart.swh.0LGEGkj9/staging-swh-cassandra.before    2024-05-24 16:16:00.194472754 +0200
+++ /tmp/swh-chart.swh.0LGEGkj9/staging-swh-cassandra.after     2024-05-24 16:16:00.794447308 +0200
@@ -6199,27 +6199,36 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
   name: database-utils
   namespace: swh-cassandra
 data:
   init-keyspace.py: |
     from swh.core import config
     from swh.storage.cassandra import create_keyspace

-    c=config.read('/etc/swh/config.yml')
+    def get_cassandra_config(storage_config):
+      if storage_config["cls"] == 'cassandra' :
+        return storage_config

-    storage_config = c["storage"]
-    hosts = storage_config.get("hosts")
+      if storage_config["cls"] == 'pipeline':
+        for config in storage_config["steps"]:
+          c = get_cassandra_config(config)
+          if c:
+            return c

-    # print(f"************ storage_config: {storage_config}" )
-    # print(f"************ hosts: {hosts}" )
+      return None
+
+    full_config = config.read('/etc/swh/config.yml')
+    storage_config = full_config["storage"]
+    cassandra_conf = get_cassandra_config(storage_config)
+    hosts = cassandra_conf.get("hosts")

     create_keyspace(hosts=hosts, keyspace='swh', auth_provider=storage_config.get("auth_provider"))

   extract-storage-postgresql-config-py: |
     import yaml
     from swh.core import config

     def get_postgresql_config(storage_config):
       if storage_config["cls"] == 'postgresql' :
         return storage_config
@@ -18758,21 +18767,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: indexer-storage-rpc
       annotations:
         checksum/config: 5ce708e81c9dbf7d47e360b2206348a3ef041a7c4fcbd75e269ad85901f9c725
-        checksum/database-utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/database-utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/rpc
                 operator: In
                 values:
                 - "true"
@@ -27547,21 +27556,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-content
       annotations:
         checksum/config: d5680e6ca19e544abde136e93d270f30716699eb148965aa3ebdcd48b3b8b78d
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -27675,21 +27684,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-directory
       annotations:
         checksum/config: 4fb0ef79bdd5ce6ff3e8a44abf4f74c31391d3a45ef43b3e0918399ff380ff07
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -27803,21 +27812,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-extid
       annotations:
         checksum/config: e3094379b0ee7982a27a1201d147cba3e171fa174a13fbd7b63f9bfc82842110
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -27931,21 +27940,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-metadata
       annotations:
         checksum/config: ee24107408cd362c96945d5d847128a3d4b2b8f94b44de51b5c99f375ca9bb07
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -28059,21 +28068,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin
       annotations:
         checksum/config: 5fce86dfaa53eb1ef7927017751c823579bd3c96d7f9e0d46f6a2f8ba5fd8cef
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -28187,21 +28196,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin-visit
       annotations:
         checksum/config: 477853a0fd3ad21dcae5667e635e5c6c8e9a191521b1037939d59f8c6755165f
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -28315,21 +28324,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin-visit-status
       annotations:
         checksum/config: 67a771e899841d09d44fe3db548c63dd33e52554f83dcc8866b65a9442ffcb60
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -28443,21 +28452,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-raw-extrinsic-metadata
       annotations:
         checksum/config: abf36180324ee584007ec0eba4951749584bdc68524496baa24bc9eb7e7419b4
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -28571,21 +28580,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-release
       annotations:
         checksum/config: e0e5e283a58d4e5d50ca446271a47ce134adc5fb5448bb762c2a361ff664e319
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -28699,21 +28708,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-revision
       annotations:
         checksum/config: 3085e6cf15602aa5a7c58aa8ca29a3cd8ab69b2dfd2dc5d36451c2a9584e7365
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -28827,21 +28836,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-skipped-content
       annotations:
         checksum/config: ac73aee02acfdb4f04fe33dceb1226c8a603754b5c601f3253670934b750d3fb
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -28955,21 +28964,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-snapshot
       annotations:
         checksum/config: 51143c9b98771e2d1fa6682472e5934d6ab343bd9de6864ff4369b5acdf736e7
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -29083,21 +29092,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-cassandra
       annotations:
         checksum/config: 1ca562ff0709dc9174c02430e7d7dc3b4aae3067b1ac5d41d16b073b396cbf31
-        checksum/database-utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/database-utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
         checksum/config-utils: 13a26f6add17e96ce01550153c77dcd48de60241a3f4db3c93d5467234be2a7f
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/storage
                 operator: In
                 values:
@@ -29239,21 +29248,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-cassandra-read-only
       annotations:
         checksum/config: b8ae6c11c13cc089647c79d7aa97da386b54caecad2d2fcc14fee329f7e9a33c
-        checksum/database-utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/database-utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
         checksum/config-utils: 13a26f6add17e96ce01550153c77dcd48de60241a3f4db3c93d5467234be2a7f
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/storage
                 operator: In
                 values:


------------- diff for environment staging namespace swh-cassandra-next-version -------------

--- /tmp/swh-chart.swh.0LGEGkj9/staging-swh-cassandra-next-version.before       2024-05-24 16:16:00.346466308 +0200
+++ /tmp/swh-chart.swh.0LGEGkj9/staging-swh-cassandra-next-version.after        2024-05-24 16:16:00.942441032 +0200
@@ -2011,27 +2011,36 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
   name: database-utils
   namespace: swh-cassandra-next-version
 data:
   init-keyspace.py: |
     from swh.core import config
     from swh.storage.cassandra import create_keyspace

-    c=config.read('/etc/swh/config.yml')
+    def get_cassandra_config(storage_config):
+      if storage_config["cls"] == 'cassandra' :
+        return storage_config

-    storage_config = c["storage"]
-    hosts = storage_config.get("hosts")
+      if storage_config["cls"] == 'pipeline':
+        for config in storage_config["steps"]:
+          c = get_cassandra_config(config)
+          if c:
+            return c

-    # print(f"************ storage_config: {storage_config}" )
-    # print(f"************ hosts: {hosts}" )
+      return None
+
+    full_config = config.read('/etc/swh/config.yml')
+    storage_config = full_config["storage"]
+    cassandra_conf = get_cassandra_config(storage_config)
+    hosts = cassandra_conf.get("hosts")

     create_keyspace(hosts=hosts, keyspace='swh', auth_provider=storage_config.get("auth_provider"))

   extract-storage-postgresql-config-py: |
     import yaml
     from swh.core import config

     def get_postgresql_config(storage_config):
       if storage_config["cls"] == 'postgresql' :
         return storage_config
@@ -14536,21 +14545,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-content
       annotations:
         checksum/config: f5eec2092742fe85cc1c257edb74589e0c028f8e210d0fdf0c923713e933dcd6
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -14664,21 +14673,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-directory
       annotations:
         checksum/config: 809bab36ca0dc72d6ad97eaf35d10c76bb46e20bd6e46dea4cd2ed77a4f9fa70
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -14792,21 +14801,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-extid
       annotations:
         checksum/config: 730c81eca19d3e1b5c7992b65dd8c025c153dd6ee72b630500d2bf9ba34a5523
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -14920,21 +14929,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-metadata
       annotations:
         checksum/config: 00488a2cbecaf6caa2e834c2a939859559d593dc7c92585dc7afa25e4215484d
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -15048,21 +15057,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin
       annotations:
         checksum/config: f2d3e1743e69612cb49351e467652ebab2dea407862a0b4231d9b316011a68f3
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -15176,21 +15185,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin-visit
       annotations:
         checksum/config: 0fd1ff57cea4c21913cc327c4f914fdd83daf8bf910ffc2b0711a250f576bff0
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -15304,21 +15313,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin-visit-status
       annotations:
         checksum/config: 838684529c6bd42fe87bd2858c6e41cab59eadb8168ec0db97d98e75fb1ad697
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -15432,21 +15441,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-raw-extrinsic-metadata
       annotations:
         checksum/config: b939073d989afe88a411110a6410d38fb1bd8b55ed285d4e97c9b4ebb5852fea
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -15560,21 +15569,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-release
       annotations:
         checksum/config: f8e15a3d8ce7784ae7b0831b4dc0dcecdc8b40df81c3f8fe510b57dc21d27e20
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -15688,21 +15697,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-revision
       annotations:
         checksum/config: 98ce591a68d6cf980d3f0ec318f6184fec96f22dfd5847c92612de594a534ea8
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -15816,21 +15825,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-skipped-content
       annotations:
         checksum/config: 2e06843bc1245901371688391ed10dbe8d88b22ab127575254e0120c99dec8a5
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -15944,21 +15953,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-snapshot
       annotations:
         checksum/config: 315c528fbcfedb699dbef895306ea973684a86c8a8e33581512f0f1adb8980e3
-        checksum/config_utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/config_utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -16072,21 +16081,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-cassandra
       annotations:
         checksum/config: 2fd93127b8c83b41f9a8aaa1889aec4fc60a57c117ef769a9a24904d5e55043e
-        checksum/database-utils: dd7d83d547731ea7598fa298565f3b1fe41eb657ae93bab75e15b722dbcc71ae
+        checksum/database-utils: 7555d31b91b62db52d0e4e07f950c28703efa68fa310e6120e65ae525b4e8112
         checksum/config-utils: 94d255131467f84bef964a4c72b2b792c5ebaf711bb1c77829d7cd1007a8ac22
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/storage
                 operator: In
                 values:


------------- diff for environment production namespace swh -------------

--- /tmp/swh-chart.swh.0LGEGkj9/production-swh.before   2024-05-24 16:16:01.222429157 +0200
+++ /tmp/swh-chart.swh.0LGEGkj9/production-swh.after    2024-05-24 16:16:01.638411514 +0200
@@ -4707,27 +4707,36 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
   name: database-utils
   namespace: swh
 data:
   init-keyspace.py: |
     from swh.core import config
     from swh.storage.cassandra import create_keyspace

-    c=config.read('/etc/swh/config.yml')
+    def get_cassandra_config(storage_config):
+      if storage_config["cls"] == 'cassandra' :
+        return storage_config

-    storage_config = c["storage"]
-    hosts = storage_config.get("hosts")
+      if storage_config["cls"] == 'pipeline':
+        for config in storage_config["steps"]:
+          c = get_cassandra_config(config)
+          if c:
+            return c

-    # print(f"************ storage_config: {storage_config}" )
-    # print(f"************ hosts: {hosts}" )
+      return None
+
+    full_config = config.read('/etc/swh/config.yml')
+    storage_config = full_config["storage"]
+    cassandra_conf = get_cassandra_config(storage_config)
+    hosts = cassandra_conf.get("hosts")

     create_keyspace(hosts=hosts, keyspace='swh', auth_provider=storage_config.get("auth_provider"))

   extract-storage-postgresql-config-py: |
     import yaml
     from swh.core import config

     def get_postgresql_config(storage_config):
       if storage_config["cls"] == 'postgresql' :
         return storage_config
@@ -16897,21 +16906,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: indexer-storage-read-only
       annotations:
         checksum/config: ea070fbf964af6768231f7af3c7c7bc5f0766ba5a9ea4ad2af0c547c102b8301
-        checksum/database-utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/database-utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/rpc
                 operator: In
                 values:
                 - "true"
@@ -17044,21 +17053,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: indexer-storage-read-write
       annotations:
         checksum/config: d9df641d5e27737c4dbc8f73df98bd87a33da54e708d9b03d2ac627825b369f1
-        checksum/database-utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/database-utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/rpc
                 operator: In
                 values:
                 - "true"
@@ -25351,21 +25360,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-postgresql-azure-readonly
       annotations:
         checksum/config: 308e3bea9873b05fbcae6399baa20ad421b57da6a8b4f9366b768699fa5b3fc4
-        checksum/database-utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/database-utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
         checksum/config-utils: d75ca13b805bce6a8ab59c8e24c938f2283108f6a79134f6e71db86308651dc6
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/storage
                 operator: In
                 values:
@@ -25590,21 +25599,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-postgresql-winery
       annotations:
         checksum/config: fbee069adc675c7686c20cc93255ca20e11590f850a777742d2a5a123489adc1
-        checksum/database-utils: 931b7f92b50eae0ecb6203c3e0e48f7c363a99ac0064451187dc12c6eaf0a793
+        checksum/database-utils: f56f201e931c40c342b165636dc2d2c917e18adc01954c4a74922b1875c85754
         checksum/config-utils: d75ca13b805bce6a8ab59c8e24c938f2283108f6a79134f6e71db86308651dc6
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/storage
                 operator: In
                 values:


------------- diff for environment production namespace swh-cassandra -------------

--- /tmp/swh-chart.swh.0LGEGkj9/production-swh-cassandra.before 2024-05-24 16:16:01.358423389 +0200
+++ /tmp/swh-chart.swh.0LGEGkj9/production-swh-cassandra.after  2024-05-24 16:16:01.778405577 +0200
@@ -1280,27 +1280,36 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
   name: database-utils
   namespace: swh-cassandra
 data:
   init-keyspace.py: |
     from swh.core import config
     from swh.storage.cassandra import create_keyspace

-    c=config.read('/etc/swh/config.yml')
+    def get_cassandra_config(storage_config):
+      if storage_config["cls"] == 'cassandra' :
+        return storage_config

-    storage_config = c["storage"]
-    hosts = storage_config.get("hosts")
+      if storage_config["cls"] == 'pipeline':
+        for config in storage_config["steps"]:
+          c = get_cassandra_config(config)
+          if c:
+            return c

-    # print(f"************ storage_config: {storage_config}" )
-    # print(f"************ hosts: {hosts}" )
+      return None
+
+    full_config = config.read('/etc/swh/config.yml')
+    storage_config = full_config["storage"]
+    cassandra_conf = get_cassandra_config(storage_config)
+    hosts = cassandra_conf.get("hosts")

     create_keyspace(hosts=hosts, keyspace='swh', auth_provider=storage_config.get("auth_provider"))

   extract-storage-postgresql-config-py: |
     import yaml
     from swh.core import config

     def get_postgresql_config(storage_config):
       if storage_config["cls"] == 'postgresql' :
         return storage_config
@@ -12197,21 +12206,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-content
       annotations:
         checksum/config: cdb30362f2e6619de7af7411b812644759dae47896085efcae39ab08d1a74bd1
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -12312,21 +12321,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-directory
       annotations:
         checksum/config: 490bd77aad60456a83fe290060ff4ba13e9fa2a3ba6d0b51625a18807a1e0f23
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -12427,21 +12436,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-extid
       annotations:
         checksum/config: 48bf68b1e842996fc0f1dd39565354863572190716809d109c745663b51c9014
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -12542,21 +12551,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-metadata
       annotations:
         checksum/config: 58e85924f4702d1e0d94ef447f49529edd518c4d05d7a7afec8f02114165bcd7
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -12657,21 +12666,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin
       annotations:
         checksum/config: 45e92c8dd52b5a3df5eea028c96e771cd30f3eaa0bb2397fc38d341d7e7a4202
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -12772,21 +12781,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin-visit
       annotations:
         checksum/config: 403e92088f4f42ea9cd4370840b5896d219f1325e1051caf93590fca84952365
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -12887,21 +12896,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-origin-visit-status
       annotations:
         checksum/config: 95c32618ce1f6eac1687070254ff9d822c2053589ac4c30f99d571bd96456804
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13002,21 +13011,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-raw-extrinsic-metadata
       annotations:
         checksum/config: 292fded243de82312509c49b0a285090662edc8cb4723d467a7951a77ba87c73
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13117,21 +13126,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-release
       annotations:
         checksum/config: 8faebf68549b5834755d4af7a6619e6595e03aff61eab6c0dabebae295816dac
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13232,21 +13241,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-revision
       annotations:
         checksum/config: e915cfe2f0b4772ffdc47e0c933c02ebcb3933e1106f6ad2acf4ad8862eecda0
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13347,21 +13356,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-skipped-content
       annotations:
         checksum/config: 4eb7f7197c4b9529dc12d8533feb5d0bbc878b16c7cee35062506c072e93c221
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13462,21 +13471,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-replayer-snapshot
       annotations:
         checksum/config: 94f2ab304922804ad361d2afb2b8a447dff2926d5a0f055c4edfc6638a21bdad
-        checksum/config_utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/config_utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/replayer
                 operator: In
                 values:
                 - "true"
@@ -13577,21 +13586,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-cassandra-readonly
       annotations:
         checksum/config: 4ad62977a82cc3e72e89c519f16b8116cc8fa73e584819e39b85a52679893846
-        checksum/database-utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/database-utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
         checksum/config-utils: 13a26f6add17e96ce01550153c77dcd48de60241a3f4db3c93d5467234be2a7f
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/storage
                 operator: In
                 values:
@@ -13810,21 +13819,21 @@
   strategy:
     type: RollingUpdate
     rollingUpdate:
       maxSurge: 1
   template:
     metadata:
       labels:
         app: storage-cassandra-readonly-internal
       annotations:
         checksum/config: 954d89159004e054b46d5a6ce70263ee4ac1ee0f4674564b8864801bb6d6b4ae
-        checksum/database-utils: 367f28d8854b3b188d7a45015752b10be8e691f0c3b2a21db02501e655b932f0
+        checksum/database-utils: 5b3b0a4a3160589e27ff01b13fd48b84d42090c0d3d144f4312f6a6f840837cc
         checksum/config-utils: 13a26f6add17e96ce01550153c77dcd48de60241a3f4db3c93d5467234be2a7f
     spec:
       affinity:
         nodeAffinity:
           requiredDuringSchedulingIgnoredDuringExecution:
             nodeSelectorTerms:
             - matchExpressions:
               - key: swh/storage
                 operator: In
                 values:

Refs. swh/infra/sysadm-environment#5315 (closed)

Edited by Antoine R. Dumont

Merge request reports