Skip to content

Commit 5ba5c15

Browse files
fix: load secrets in data-sync cron containers (#3165)
fix: load secrets in data-sync cron containers
2 parents 9bd507c + c24000e commit 5ba5c15

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

hokusai/production.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ spec:
305305
- name: secrets
306306
mountPath: /secrets
307307
readOnly: true
308+
- name: scripts
309+
mountPath: /usr/local/bin/load_secrets_and_run.sh
310+
subPath: load_secrets_and_run.sh
311+
command: ["/usr/local/bin/load_secrets_and_run.sh"]
308312
args:
309313
- sh
310314
- ./export-db.sh
@@ -323,6 +327,27 @@ spec:
323327
volumes:
324328
- name: secrets
325329
emptyDir: {}
330+
- name: scripts
331+
configMap:
332+
name: positron-scripts
333+
defaultMode: 0755
334+
---
335+
apiVersion: v1
336+
kind: ConfigMap
337+
metadata:
338+
name: positron-scripts
339+
namespace: default
340+
data:
341+
load_secrets_and_run.sh: |
342+
#!/bin/bash
343+
CMD="$@"
344+
if [ ! -z "$SECRETS_FILE" ]
345+
then
346+
echo "SECRETS_FILE env var is defined. Sourcing secrets file..."
347+
source "$SECRETS_FILE"
348+
fi
349+
echo "Running command: $CMD"
350+
$CMD
326351
---
327352
apiVersion: v1
328353
kind: Service

hokusai/staging.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ spec:
306306
- name: secrets
307307
mountPath: /secrets
308308
readOnly: true
309+
- name: scripts
310+
mountPath: /usr/local/bin/load_secrets_and_run.sh
311+
subPath: load_secrets_and_run.sh
312+
command: ["/usr/local/bin/load_secrets_and_run.sh"]
309313
args:
310314
- sh
311315
- ./import-db.sh
@@ -324,6 +328,27 @@ spec:
324328
volumes:
325329
- name: secrets
326330
emptyDir: {}
331+
- name: scripts
332+
configMap:
333+
name: positron-scripts
334+
defaultMode: 0755
335+
---
336+
apiVersion: v1
337+
kind: ConfigMap
338+
metadata:
339+
name: positron-scripts
340+
namespace: default
341+
data:
342+
load_secrets_and_run.sh: |
343+
#!/bin/bash
344+
CMD="$@"
345+
if [ ! -z "$SECRETS_FILE" ]
346+
then
347+
echo "SECRETS_FILE env var is defined. Sourcing secrets file..."
348+
source "$SECRETS_FILE"
349+
fi
350+
echo "Running command: $CMD"
351+
$CMD
327352
---
328353
apiVersion: v1
329354
kind: Service

0 commit comments

Comments
 (0)