40 lines
1.2 KiB
Bash
40 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|||
|
|
# Deploy the Gitea act_runner (with DinD) onto k3s.
|
||
|
|
#
|
||
|
|
# Usage:
|
||
|
|
# ./scripts/deploy.sh
|
||
|
|
#
|
||
|
|
# Prerequisites:
|
||
|
|
# - kubectl configured against your k3s cluster
|
||
|
|
# (e.g. export KUBECONFIG=/etc/rancher/k3s/k3s.yaml)
|
||
|
|
# - k3s/10-runner-secret.yaml created from the .example and filled in.
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||
|
|
K3S_DIR="${ROOT_DIR}/k3s"
|
||
|
|
|
||
|
|
if [[ ! -f "${K3S_DIR}/10-runner-secret.yaml" ]]; then
|
||
|
|
echo "ERROR: ${K3S_DIR}/10-runner-secret.yaml not found." >&2
|
||
|
|
echo " cp ${K3S_DIR}/10-runner-secret.yaml.example ${K3S_DIR}/10-runner-secret.yaml" >&2
|
||
|
|
echo " then fill in GITEA_INSTANCE_URL and the registration token." >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo ">> Applying namespace"
|
||
|
|
kubectl apply -f "${K3S_DIR}/00-namespace.yaml"
|
||
|
|
|
||
|
|
echo ">> Applying runner registration secret"
|
||
|
|
kubectl apply -f "${K3S_DIR}/10-runner-secret.yaml"
|
||
|
|
|
||
|
|
echo ">> Applying runner config"
|
||
|
|
kubectl apply -f "${K3S_DIR}/20-runner-config.yaml"
|
||
|
|
|
||
|
|
echo ">> Applying runner deployment"
|
||
|
|
kubectl apply -f "${K3S_DIR}/30-runner-deployment.yaml"
|
||
|
|
|
||
|
|
echo ">> Waiting for rollout"
|
||
|
|
kubectl -n gitea-runner rollout status deploy/act-runner --timeout=180s
|
||
|
|
|
||
|
|
echo ">> Done. Runner pods:"
|
||
|
|
kubectl -n gitea-runner get pods -o wide
|