From 2f1dba494b3770877487e3a8450c10dc760a3dd5 Mon Sep 17 00:00:00 2001 From: Manohar Reddy Date: Wed, 10 Jun 2026 11:20:43 +0200 Subject: [PATCH] option to configure imagepull secrets --- simplyblock_web/api/internal/storage_node/kubernetes.py | 7 +++++++ .../templates/oc_storage_core_isolation.yaml.j2 | 6 ++++++ simplyblock_web/templates/oc_storage_cpu_topology.yaml.j2 | 6 ++++++ simplyblock_web/templates/storage_core_isolation.yaml.j2 | 6 ++++++ simplyblock_web/templates/storage_cpu_topology.yaml.j2 | 6 ++++++ simplyblock_web/templates/storage_deploy_spdk.yaml.j2 | 6 ++++++ simplyblock_web/templates/storage_init_job.yaml.j2 | 6 ++++++ simplyblock_web/templates/ubuntu_kernel_extra.yaml.j2 | 6 ++++++ 8 files changed, 49 insertions(+) diff --git a/simplyblock_web/api/internal/storage_node/kubernetes.py b/simplyblock_web/api/internal/storage_node/kubernetes.py index b0abd91c09..78103674c1 100644 --- a/simplyblock_web/api/internal/storage_node/kubernetes.py +++ b/simplyblock_web/api/internal/storage_node/kubernetes.py @@ -346,6 +346,12 @@ def spdk_process_start(body: SPDKParams): try: env = Environment(loader=PackageLoader('simplyblock_web', 'templates'), trim_blocks=True, lstrip_blocks=True) + image_pull_secrets_raw = os.environ.get("IMAGE_PULL_SECRETS", "") + try: + image_pull_secrets = [{"name": n} for n in json.loads(image_pull_secrets_raw)] if image_pull_secrets_raw else [] + except Exception: + image_pull_secrets = [] + values = { 'SPDK_IMAGE': body.spdk_image, "L_CORES": body.l_cores, @@ -378,6 +384,7 @@ def spdk_process_start(body: SPDKParams): 'TLS_CONNECT': settings.tls_connect, 'TLS_CLIENT_AUTH': settings.model_dump()["tls_client_auth"], 'TLS_PROVIDER': settings.tls_provider, + 'IMAGE_PULL_SECRETS': image_pull_secrets, } if ubuntu_host: diff --git a/simplyblock_web/templates/oc_storage_core_isolation.yaml.j2 b/simplyblock_web/templates/oc_storage_core_isolation.yaml.j2 index 9b7aa77062..9da393d4e7 100644 --- a/simplyblock_web/templates/oc_storage_core_isolation.yaml.j2 +++ b/simplyblock_web/templates/oc_storage_core_isolation.yaml.j2 @@ -17,6 +17,12 @@ spec: operator: Exists - effect: NoExecute operator: Exists + {% if IMAGE_PULL_SECRETS %} + imagePullSecrets: + {% for secret in IMAGE_PULL_SECRETS %} + - name: {{ secret.name }} + {% endfor %} + {% endif %} volumes: - name: var-simplyblock hostPath: diff --git a/simplyblock_web/templates/oc_storage_cpu_topology.yaml.j2 b/simplyblock_web/templates/oc_storage_cpu_topology.yaml.j2 index 4191cfa40f..4fbab5a29d 100755 --- a/simplyblock_web/templates/oc_storage_cpu_topology.yaml.j2 +++ b/simplyblock_web/templates/oc_storage_cpu_topology.yaml.j2 @@ -17,6 +17,12 @@ spec: operator: Exists - effect: NoExecute operator: Exists + {% if IMAGE_PULL_SECRETS %} + imagePullSecrets: + {% for secret in IMAGE_PULL_SECRETS %} + - name: {{ secret.name }} + {% endfor %} + {% endif %} volumes: - name: var-simplyblock hostPath: diff --git a/simplyblock_web/templates/storage_core_isolation.yaml.j2 b/simplyblock_web/templates/storage_core_isolation.yaml.j2 index 1999eda769..9c96c6a50e 100644 --- a/simplyblock_web/templates/storage_core_isolation.yaml.j2 +++ b/simplyblock_web/templates/storage_core_isolation.yaml.j2 @@ -17,6 +17,12 @@ spec: operator: Exists - effect: NoExecute operator: Exists + {% if IMAGE_PULL_SECRETS %} + imagePullSecrets: + {% for secret in IMAGE_PULL_SECRETS %} + - name: {{ secret.name }} + {% endfor %} + {% endif %} volumes: - name: boot hostPath: diff --git a/simplyblock_web/templates/storage_cpu_topology.yaml.j2 b/simplyblock_web/templates/storage_cpu_topology.yaml.j2 index 667d6468d0..494da945db 100644 --- a/simplyblock_web/templates/storage_cpu_topology.yaml.j2 +++ b/simplyblock_web/templates/storage_cpu_topology.yaml.j2 @@ -19,6 +19,12 @@ spec: operator: Exists - effect: NoExecute operator: Exists + {% if IMAGE_PULL_SECRETS %} + imagePullSecrets: + {% for secret in IMAGE_PULL_SECRETS %} + - name: {{ secret.name }} + {% endfor %} + {% endif %} volumes: - name: host diff --git a/simplyblock_web/templates/storage_deploy_spdk.yaml.j2 b/simplyblock_web/templates/storage_deploy_spdk.yaml.j2 index c9e5c12072..5a1d7279ef 100755 --- a/simplyblock_web/templates/storage_deploy_spdk.yaml.j2 +++ b/simplyblock_web/templates/storage_deploy_spdk.yaml.j2 @@ -22,6 +22,12 @@ spec: operator: Exists - effect: NoExecute operator: Exists + {% if IMAGE_PULL_SECRETS %} + imagePullSecrets: + {% for secret in IMAGE_PULL_SECRETS %} + - name: {{ secret.name }} + {% endfor %} + {% endif %} volumes: - name: socket-dir emptyDir: diff --git a/simplyblock_web/templates/storage_init_job.yaml.j2 b/simplyblock_web/templates/storage_init_job.yaml.j2 index 9f93810baa..16cd6778c3 100644 --- a/simplyblock_web/templates/storage_init_job.yaml.j2 +++ b/simplyblock_web/templates/storage_init_job.yaml.j2 @@ -17,6 +17,12 @@ spec: operator: Exists - effect: NoExecute operator: Exists + {% if IMAGE_PULL_SECRETS %} + imagePullSecrets: + {% for secret in IMAGE_PULL_SECRETS %} + - name: {{ secret.name }} + {% endfor %} + {% endif %} volumes: - name: host-proc hostPath: diff --git a/simplyblock_web/templates/ubuntu_kernel_extra.yaml.j2 b/simplyblock_web/templates/ubuntu_kernel_extra.yaml.j2 index 98f950a1be..b4d9a2ddf0 100644 --- a/simplyblock_web/templates/ubuntu_kernel_extra.yaml.j2 +++ b/simplyblock_web/templates/ubuntu_kernel_extra.yaml.j2 @@ -17,6 +17,12 @@ spec: operator: Exists - effect: NoExecute operator: Exists + {% if IMAGE_PULL_SECRETS %} + imagePullSecrets: + {% for secret in IMAGE_PULL_SECRETS %} + - name: {{ secret.name }} + {% endfor %} + {% endif %} volumes: - name: rootfs hostPath: