Files
coturn-kubernetes/bootstrap-turn-secret.sh
T
feedc0de 22f0fce902
Validate and deploy coturn / Validate manifests (push) Successful in 16s
Validate and deploy coturn / Deploy to Kubernetes (push) Canceled after 3m27s
First try with CI
2026-08-24 10:51:38 +02:00

35 lines
950 B
Bash
Executable File

#!/bin/sh
set -eu
SECRET_NAME=turn-shared-secret
if [ -z "${TURN_SHARED_SECRET:-}" ]; then
echo "Set TURN_SHARED_SECRET to the existing 64-character shared secret." >&2
exit 1
fi
case "$TURN_SHARED_SECRET" in
*[!0-9a-f]*|'')
echo "TURN_SHARED_SECRET must contain lowercase hexadecimal characters only." >&2
exit 1
;;
esac
if [ "${#TURN_SHARED_SECRET}" -ne 64 ]; then
echo "TURN_SHARED_SECRET must be exactly 64 characters." >&2
exit 1
fi
for namespace in coturn matrix; do
kubectl create namespace "$namespace" --dry-run=client --output=yaml \
| kubectl apply --filename=-
kubectl create secret generic "$SECRET_NAME" \
--namespace "$namespace" \
--from-literal="shared-secret=$TURN_SHARED_SECRET" \
--dry-run=client --output=yaml \
| kubectl apply --filename=-
done
echo "Stored the existing TURN shared secret in coturn/$SECRET_NAME and matrix/$SECRET_NAME."