Files
factorio/bootstrap.sh
T
feedc0de bf806c886c
Validate, publish and promote Factorio chart / chart (push) Failing after 10s
Publish Factorio deployment as a Helm chart
2026-10-27 07:16:05 +01:00

13 lines
694 B
Bash
Executable File

#!/usr/bin/env bash
# One-time administrator bootstrap for the existing namespace and runtime Secret.
set -euo pipefail
root=$(cd -- "$(dirname -- "$0")" && pwd)
[[ $(kubectl config current-context) == kubernetes-admin@kubernetes ]] || { echo 'Wrong Kubernetes context' >&2; exit 1; }
kubectl apply -f "$root/namespace.yaml"
if ! kubectl -n factorio get secret factorio-runtime >/dev/null 2>&1; then
python3 - <<'PY' | kubectl create -f -
import base64,json,secrets
print(json.dumps({'apiVersion':'v1','kind':'Secret','metadata':{'name':'factorio-runtime','namespace':'factorio'},'type':'Opaque','data':{'rcon-password':base64.b64encode(secrets.token_urlsafe(32).encode()).decode()}}))
PY
fi