From 29fad166ab835b78d135b052176065a8ea670f70 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Wed, 13 Dec 2023 14:05:35 +0100
Subject: [PATCH] indexer_storage: Use config-utils image to ease configuration
 step

Refs. swh/infra/sysadm-environment#5183
---
 swh/templates/indexer-storage/deployment.yaml | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/swh/templates/indexer-storage/deployment.yaml b/swh/templates/indexer-storage/deployment.yaml
index fa6a24caf..7efd8864e 100644
--- a/swh/templates/indexer-storage/deployment.yaml
+++ b/swh/templates/indexer-storage/deployment.yaml
@@ -45,13 +45,10 @@ spec:
       {{- end }}
       initContainers:
         - name: prepare-configuration
-          image: debian:bullseye
+          image: {{ $.Values.swh_utils_image }}:{{ $.Values.swh_utils_image_version }}
           imagePullPolicy: IfNotPresent
           command:
-          - /bin/bash
-          args:
-          - -c
-          - eval echo "\"$(</etc/swh/configuration-template/config.yml.template)\"" > /etc/swh/config.yml
+          - /entrypoints/prepare-configuration.sh
           env:
             {{ include "swh.secrets.environment" (dict "configurationRef" $storage_config.indexerStorageConfigurationRef
                                                        "Values" $.Values) | nindent 10 }}
@@ -60,6 +57,9 @@ spec:
             mountPath: /etc/swh
           - name: configuration-template
             mountPath: /etc/swh/configuration-template
+          - name: config-utils
+            mountPath: /entrypoints
+            readOnly: true
         {{- if $storage_config.checkDbVersion }}
         {{ include "swh.checkDatabaseVersionContainer" (dict "Values" $.Values
                                                              "imagePrefixName" "swh_indexer_storage_image"
@@ -150,6 +150,10 @@ spec:
         configMap:
           name: database-utils
           defaultMode: 0555
+      - name: config-utils
+        configMap:
+          name: config-utils
+          defaultMode: 0555
 {{ end }}
 {{ end -}}
 {{- end -}}
-- 
GitLab