Skip to content

Commit c73320c

Browse files
author
Pablo Garcia Miranda
committed
Create patch to inject the NETBOX_SQL_DUMP_URL inside the Docker container
1 parent 75a35c7 commit c73320c

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

kind/deploy-netbox.sh

+24
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,30 @@ JOB_DIR="$(dirname "$0")/job"
164164

165165
cd "$JOB_DIR"
166166
kustomize edit set image ghcr.io/zalando/spilo-16="${SPILO_IMAGE:-ghcr.io/zalando/spilo-16:3.2-p3}"
167+
168+
# Create a patch file to inject NETBOX_SQL_DUMP_URL (from env or default)
169+
SQL_DUMP_URL="${NETBOX_SQL_DUMP_URL:-https://raw.githubusercontent.com/netbox-community/netbox-demo-data/master/sql/netbox-demo-v4.1.sql}"
170+
171+
# Create patch
172+
cat > sql-env-patch.yaml <<EOF
173+
apiVersion: batch/v1
174+
kind: Job
175+
metadata:
176+
name: netbox-demo-data-load-job
177+
spec:
178+
template:
179+
spec:
180+
containers:
181+
- name: netbox-demo-data-load
182+
env:
183+
- name: NETBOX_SQL_DUMP_URL
184+
value: "${SQL_DUMP_URL}"
185+
EOF
186+
187+
# Add the patch
188+
kustomize edit add patch --path sql-env-patch.yaml
189+
190+
# Apply the customized job
167191
kustomize build . | ${KUBECTL} apply -n "${NAMESPACE}" -f -
168192

169193
${KUBECTL} wait \

kind/job/kustomization.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ kind: Kustomization
66
images:
77
- name: ghcr.io/zalando/spilo-16
88
newName: mobile-docker-virtual.artifactory.swisscom.com/zalando/spilo-16
9-
newTag: 3.2-p3
9+
newTag: 3.2-p3
10+
patches:
11+
- path: sql-env-patch.yaml

0 commit comments

Comments
 (0)