@@ -5,7 +5,8 @@ set -e -u -o pipefail
5
5
# • a local kind cluster (preloading images)
6
6
# • a virtual cluster using vcluster: https://github.com/loft-sh/vcluster ( used for testing pipeline, loading of images not needed )
7
7
8
- NETBOX_HELM_CHART=" https://github.com/netbox-community/netbox-chart/releases/download/netbox-5.0.0-beta.169/netbox-5.0.0-beta.169.tgz" # default value
8
+ # Allow override via environment variable, otherwise fallback to default
9
+ NETBOX_HELM_CHART=" ${NETBOX_HELM_CHART:- https:// github.com/ netbox-community/ netbox-chart/ releases/ download/ netbox-5.0.0-beta.169/ netbox-5.0.0-beta.169.tgz} "
9
10
10
11
if [[ $# -lt 3 || $# -gt 4 ]]; then
11
12
echo " Usage: $0 <CLUSTER> <VERSION> <NAMESPACE> [--vcluster]"
@@ -42,7 +43,8 @@ if [[ "${VERSION}" == "3.7.8" ]] ;then
42
43
" ghcr.io/zalando/postgres-operator:v1.12.2" \
43
44
" ghcr.io/zalando/spilo-16:3.2-p3" \
44
45
)
45
- NETBOX_HELM_CHART=" https://github.com/netbox-community/netbox-chart/releases/download/netbox-5.0.0-beta5/netbox-5.0.0-beta5.tgz"
46
+ # Allow override via environment variable, otherwise fallback to default
47
+ NETBOX_HELM_CHART=" ${NETBOX_HELM_CHART:- https:// github.com/ netbox-community/ netbox-chart/ releases/ download/ netbox-5.0.0-beta5/ netbox-5.0.0-beta5.tgz} "
46
48
47
49
# patch load-data.sh
48
50
sed ' s/netbox-demo-v4.1.sql/netbox-demo-v3.7.sql/g' $( dirname " $0 " ) /load-data-job/load-data.orig.sh > $( dirname " $0 " ) /load-data-job/load-data.sh && chmod +x $( dirname " $0 " ) /load-data-job/load-data.sh
@@ -59,7 +61,8 @@ elif [[ "${VERSION}" == "4.0.11" ]] ;then
59
61
" ghcr.io/zalando/postgres-operator:v1.12.2" \
60
62
" ghcr.io/zalando/spilo-16:3.2-p3" \
61
63
)
62
- NETBOX_HELM_CHART=" https://github.com/netbox-community/netbox-chart/releases/download/netbox-5.0.0-beta.84/netbox-5.0.0-beta.84.tgz"
64
+ # Allow override via environment variable, otherwise fallback to default
65
+ NETBOX_HELM_CHART=" ${NETBOX_HELM_CHART:- https:// github.com/ netbox-community/ netbox-chart/ releases/ download/ netbox-5.0.0-beta.84/ netbox-5.0.0-beta.84.tgz} "
63
66
64
67
# patch load-data.sh
65
68
sed ' s/netbox-demo-v4.1.sql/netbox-demo-v4.0.sql/g' $( dirname " $0 " ) /load-data-job/load-data.orig.sh > $( dirname " $0 " ) /load-data-job/load-data.sh && chmod +x $( dirname " $0 " ) /load-data-job/load-data.sh
98
101
99
102
# build image for loading local data via NetBox API
100
103
cd " $( dirname " $0 " ) /load-data-job"
101
- docker build -t netbox-load-local-data:1.0 --load --no-cache --progress=plain -f ./dockerfile .
104
+ docker build -t netbox-load-local-data:1.0 \
105
+ --load --no-cache --progress=plain \
106
+ --build-arg PYTHON_BASE_IMAGE=" ${PYTHON_BASE_IMAGE:- python: 3.12} " \
107
+ --build-arg ARTIFACTORY_PYPI_URL=" ${ARTIFACTORY_PYPI_URL:- } " \
108
+ --build-arg ARTIFACTORY_TRUSTED_HOST=" ${ARTIFACTORY_TRUSTED_HOST:- } " \
109
+ -f ./dockerfile .
102
110
cd -
103
111
104
112
# Load local images into Kind only if not vCluster
@@ -115,13 +123,15 @@ else
115
123
fi
116
124
117
125
# Install Postgres Operator
126
+ # Allow override via environment variable, otherwise fallback to default
127
+ POSTGRESS_OPERATOR_HELM_CHART=" ${POSTGRESS_OPERATOR_HELM_CHART:- https:// opensource.zalando.com/ postgres-operator/ charts/ postgres-operator/ postgres-operator-1.12.2.tgz} "
118
128
${HELM} upgrade --install postgres-operator \
119
129
--namespace=" ${NAMESPACE} " \
120
130
--create-namespace \
121
131
--set podPriorityClassName.create=false \
122
132
--set podServiceAccount.name=" postgres-pod-${NAMESPACE} " \
123
133
--set serviceAccount.name=" postgres-operator-${NAMESPACE} " \
124
- https://opensource.zalando.com/postgres-operator/charts/postgres-operator/postgres-operator-1.12.2.tgz
134
+ " ${POSTGRESS_OPERATOR_HELM_CHART} "
125
135
126
136
# Deploy the database
127
137
${KUBECTL} apply --namespace=" ${NAMESPACE} " -f " $( dirname " $0 " ) /netbox-db.yaml"
@@ -150,8 +160,11 @@ else
150
160
| ${KUBECTL} apply -f -
151
161
fi
152
162
153
- ${KUBECTL} apply -n " ${NAMESPACE} " \
154
- -f " $( dirname " $0 " ) /load-data-job.yaml"
163
+ JOB_DIR=" $( dirname " $0 " ) /job"
164
+
165
+ cd " $JOB_DIR "
166
+ kustomize edit set image ghcr.io/zalando/spilo-16=" ${SPILO_IMAGE:- ghcr.io/ zalando/ spilo-16: 3.2-p3} "
167
+ kustomize build . | ${KUBECTL} apply -n " ${NAMESPACE} " -f -
155
168
156
169
${KUBECTL} wait \
157
170
-n " ${NAMESPACE} " --for=condition=complete --timeout=600s job/netbox-demo-data-load-job
0 commit comments