2021-09-14 08:32:10 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2021-11-20 08:55:23 +01:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
2024-12-28 18:07:44 +01:00
|
|
|
kind create cluster --config kind/kind.yaml --wait 10m
|
2021-09-14 08:32:10 +02:00
|
|
|
|
|
|
|
|
kubectl create secret docker-registry gitlab \
|
|
|
|
|
--docker-server=registry.gitlab.com \
|
|
|
|
|
--docker-username=gitlab \
|
|
|
|
|
--docker-password="${GITLAB_TOKEN}" \
|
2023-04-10 22:30:16 +02:00
|
|
|
--docker-email=gitlab@unbound.se
|
2021-09-14 08:32:10 +02:00
|
|
|
|
|
|
|
|
kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "gitlab"}]}'
|
|
|
|
|
|
2025-12-10 08:16:27 +01:00
|
|
|
kustomized="$(mktemp -t unboundnginx.yaml.XXXXXX)"
|
2024-09-12 20:12:38 +02:00
|
|
|
|
2025-12-10 08:16:27 +01:00
|
|
|
kubectl kustomize --enable-helm "k8s/nginx" >> "${kustomized}"
|
2025-08-03 13:13:13 +02:00
|
|
|
kubectl apply -f "${kustomized}" --server-side || true
|
2025-12-10 08:16:27 +01:00
|
|
|
|
|
|
|
|
printf "\nWait for pod app.kubernetes.io/component=controller to be created."
|
|
|
|
|
while :; do
|
|
|
|
|
sleep 2
|
|
|
|
|
[ -n "$(kubectl -n ingress-nginx get pod --selector=app.kubernetes.io/component=controller 2>/dev/null)" ] && printf "\n\n" && break
|
|
|
|
|
printf "."
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo "Wait for nginx to be available."
|
|
|
|
|
until [[ $(kubectl -n ingress-nginx get endpointslices -l 'kubernetes.io/service-name=ingress-nginx-controller' -o=jsonpath='{.items[*].endpoints[*].addresses[*]}') ]]; do sleep 5; done
|
|
|
|
|
|
|
|
|
|
kustomized="$(mktemp -t unboundinfra.yaml.XXXXXX)"
|
|
|
|
|
|
|
|
|
|
kubectl kustomize --enable-helm "k8s/infra" >> "${kustomized}"
|
|
|
|
|
kubectl apply -f "${kustomized}" --server-side || true
|
|
|
|
|
|
|
|
|
|
printf "\nWait for pod app.kubernetes.io/instance=cert-manager to be created."
|
|
|
|
|
while :; do
|
|
|
|
|
sleep 2
|
|
|
|
|
[ -n "$(kubectl -n cert-manager get pod --selector=app.kubernetes.io/instance=cert-manager 2>/dev/null)" ] && printf "\n\n" && break
|
|
|
|
|
printf "."
|
|
|
|
|
done
|
|
|
|
|
kubectl wait --for=condition=Ready pods -n cert-manager -l app=cert-manager --timeout 4m
|
|
|
|
|
kubectl wait --for=condition=Ready pods -n cert-manager -l app=cainjector --timeout 4m
|
|
|
|
|
kubectl wait --for=condition=Ready pods -n cert-manager -l app=webhook --timeout 4m
|
2023-04-10 22:30:16 +02:00
|
|
|
kubectl wait --for=condition=Ready pods --all -n external-secrets --timeout=5m
|
2025-12-10 08:16:27 +01:00
|
|
|
# Apply again to get any CRD's that wasn't applied earlier since the definitions wasn't available
|
|
|
|
|
kubectl apply -f "${kustomized}" --server-side || true
|
|
|
|
|
kubectl apply -k k8s/app --server-side
|
2021-10-01 17:50:01 +02:00
|
|
|
|
2025-12-10 08:16:27 +01:00
|
|
|
kubectl wait --for=condition=Ready pods -n cert-manager -l app=cert-manager --timeout 4m
|
|
|
|
|
kubectl wait --for=condition=Ready pods -n cert-manager -l app=cainjector --timeout 4m
|
|
|
|
|
kubectl wait --for=condition=Ready pods -n cert-manager -l app=webhook --timeout 4m
|
|
|
|
|
kubectl wait --for=condition=Ready pods --all -n external-secrets --timeout=5m
|
|
|
|
|
kubectl wait --for=condition=Ready pods --all -n default --timeout 3m
|