130 lines
5.1 KiB
Shell
130 lines
5.1 KiB
Shell
render_manifests() {
|
|
local postgres="$1" redis="$2" dragonfly="$3" keycloak="$4" zitadel="$5"
|
|
local garage="$6" versitygw="$7" coredns="$8" curl="$9" aws_cli="${10}"
|
|
local postgres_replicas="${11}" redis_replicas="${12}" dragonfly_replicas="${13}"
|
|
local keycloak_replicas="${14}" zitadel_replicas="${15}"
|
|
local garage_replicas="${16}" versitygw_replicas="${17}" coredns_replicas="${18}"
|
|
sed \
|
|
-e "s|@@POSTGRES_IMAGE@@|$postgres|g" \
|
|
-e "s|@@REDIS_IMAGE@@|$redis|g" \
|
|
-e "s|@@DRAGONFLY_IMAGE@@|$dragonfly|g" \
|
|
-e "s|@@KEYCLOAK_IMAGE@@|$keycloak|g" \
|
|
-e "s|@@ZITADEL_IMAGE@@|$zitadel|g" \
|
|
-e "s|@@GARAGE_IMAGE@@|$garage|g" \
|
|
-e "s|@@VERSITYGW_IMAGE@@|$versitygw|g" \
|
|
-e "s|@@COREDNS_IMAGE@@|$coredns|g" \
|
|
-e "s|@@CURL_IMAGE@@|$curl|g" \
|
|
-e "s|@@AWS_CLI_IMAGE@@|$aws_cli|g" \
|
|
-e "s|@@POSTGRES_REPLICAS@@|$postgres_replicas|g" \
|
|
-e "s|@@REDIS_REPLICAS@@|$redis_replicas|g" \
|
|
-e "s|@@DRAGONFLY_REPLICAS@@|$dragonfly_replicas|g" \
|
|
-e "s|@@KEYCLOAK_REPLICAS@@|$keycloak_replicas|g" \
|
|
-e "s|@@ZITADEL_REPLICAS@@|$zitadel_replicas|g" \
|
|
-e "s|@@GARAGE_REPLICAS@@|$garage_replicas|g" \
|
|
-e "s|@@VERSITYGW_REPLICAS@@|$versitygw_replicas|g" \
|
|
-e "s|@@COREDNS_REPLICAS@@|$coredns_replicas|g" \
|
|
"$TESTBED/dependencies.yaml.in" > "$RUNTIME/dependencies.yaml"
|
|
{
|
|
printf 'POSTGRES_LOCAL_IMAGE=%q\n' "$postgres"
|
|
printf 'REDIS_LOCAL_IMAGE=%q\n' "$redis"
|
|
printf 'DRAGONFLY_LOCAL_IMAGE=%q\n' "$dragonfly"
|
|
printf 'KEYCLOAK_LOCAL_IMAGE=%q\n' "$keycloak"
|
|
printf 'ZITADEL_LOCAL_IMAGE=%q\n' "$zitadel"
|
|
printf 'GARAGE_LOCAL_IMAGE=%q\n' "$garage"
|
|
printf 'VERSITYGW_LOCAL_IMAGE=%q\n' "$versitygw"
|
|
printf 'COREDNS_LOCAL_IMAGE=%q\n' "$coredns"
|
|
printf 'CURL_LOCAL_IMAGE=%q\n' "$curl"
|
|
printf 'AWS_CLI_LOCAL_IMAGE=%q\n' "$aws_cli"
|
|
} > "$RUNTIME/fixture.env"
|
|
}
|
|
|
|
setup_fixture() {
|
|
select_fixture_families "$@" || return
|
|
mkdir -p "$RUNTIME"
|
|
rm -rf "$RUNTIME/image-archives"
|
|
mkdir -p "$RUNTIME/image-archives"
|
|
prepare_tools
|
|
prepare_provider
|
|
"$BIN/kind" create cluster \
|
|
--name "$CLUSTER" \
|
|
--image "$NODE_IMAGE" \
|
|
--config "$TESTBED/cluster.yaml" \
|
|
--kubeconfig "$KUBECONFIG_PATH" \
|
|
--wait 180s
|
|
local postgres=nuthatch-testbed/unused:postgres
|
|
local redis=nuthatch-testbed/unused:redis
|
|
local dragonfly=nuthatch-testbed/unused:dragonfly
|
|
local keycloak=nuthatch-testbed/unused:keycloak
|
|
local zitadel=nuthatch-testbed/unused:zitadel
|
|
local garage=nuthatch-testbed/unused:garage
|
|
local versitygw=nuthatch-testbed/unused:versitygw
|
|
local coredns=nuthatch-testbed/unused:coredns
|
|
local curl=nuthatch-testbed/unused:curl
|
|
local aws_cli=nuthatch-testbed/unused:aws-cli
|
|
local postgres_replicas=0 redis_replicas=0 dragonfly_replicas=0
|
|
local keycloak_replicas=0 zitadel_replicas=0
|
|
local garage_replicas=0 versitygw_replicas=0 coredns_replicas=0
|
|
if fixture_has_family durable || fixture_has_family oidc; then
|
|
postgres="$(load_external_image postgres "$POSTGRES_IMAGE")"
|
|
postgres_replicas=1
|
|
fi
|
|
if fixture_has_family coordination; then
|
|
redis="$(load_external_image redis "$REDIS_IMAGE")"
|
|
dragonfly="$(load_external_image dragonfly "$DRAGONFLY_IMAGE")"
|
|
redis_replicas=1
|
|
dragonfly_replicas=1
|
|
fi
|
|
if fixture_has_family oidc; then
|
|
keycloak="$(load_external_image keycloak "$KEYCLOAK_IMAGE")"
|
|
zitadel="$(load_external_image zitadel "$ZITADEL_IMAGE")"
|
|
coredns="$(load_external_image coredns "$COREDNS_IMAGE")"
|
|
curl="$(load_external_image curl "$CURL_IMAGE")"
|
|
keycloak_replicas=1
|
|
zitadel_replicas=1
|
|
coredns_replicas=1
|
|
fi
|
|
if fixture_has_family target; then
|
|
garage="$(load_external_image garage "$GARAGE_IMAGE")"
|
|
versitygw="$(load_external_image versitygw "$VERSITYGW_IMAGE")"
|
|
aws_cli="$(load_external_image aws-cli "$AWS_CLI_IMAGE")"
|
|
if [[ "$curl" = nuthatch-testbed/unused:curl ]]; then
|
|
curl="$(load_external_image curl "$CURL_IMAGE")"
|
|
fi
|
|
garage_replicas=1
|
|
versitygw_replicas=1
|
|
fi
|
|
render_manifests "$postgres" "$redis" "$dragonfly" "$keycloak" "$zitadel" \
|
|
"$garage" "$versitygw" "$coredns" "$curl" "$aws_cli" \
|
|
"$postgres_replicas" "$redis_replicas" "$dragonfly_replicas" \
|
|
"$keycloak_replicas" "$zitadel_replicas" \
|
|
"$garage_replicas" "$versitygw_replicas" "$coredns_replicas"
|
|
kube apply --filename "$RUNTIME/dependencies.yaml"
|
|
if fixture_has_family durable || fixture_has_family oidc; then
|
|
wait_for_deployment postgres
|
|
fi
|
|
if fixture_has_family coordination; then
|
|
wait_for_deployment redis
|
|
wait_for_deployment dragonfly
|
|
fi
|
|
if fixture_has_family oidc; then
|
|
wait_for_deployment keycloak
|
|
wait_for_deployment zitadel
|
|
wait_for_deployment controlled-dns
|
|
fi
|
|
if fixture_has_family target; then
|
|
wait_for_deployment garage
|
|
wait_for_deployment versitygw
|
|
fi
|
|
}
|
|
|
|
wait_for_deployment() {
|
|
kube --namespace "$FIXTURE_NAMESPACE" rollout status "deployment/$1" --timeout 240s
|
|
}
|
|
|
|
verify_dependencies() {
|
|
local test_image="$1"
|
|
sed "s|@@TEST_IMAGE@@|$test_image|g" \
|
|
"$TESTBED/probe.yaml.in" >"$RUNTIME/probe.yaml"
|
|
kube apply --filename "$RUNTIME/probe.yaml"
|
|
wait_for_job dependency-probe
|
|
}
|