Upload files to "root"

This commit is contained in:
2026-07-18 20:37:21 +00:00
parent 6acb4879aa
commit 54d5e15b90
3 changed files with 183 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'
CLUSTER_NAME="${CLUSTER_NAME:-lab-cluster}"
RUNNER_NAME="${GITEA_RUNNER_CONTAINER:-gitea-runner}"
KUBECONFIG_PATH="${KUBECONFIG_PATH:-/DATA/.kube/config}"
export KUBECONFIG="$KUBECONFIG_PATH"
echo "== Políticas k3d =="
docker inspect \
"k3d-${CLUSTER_NAME}-server-0" \
"k3d-${CLUSTER_NAME}-agent-0" \
"k3d-${CLUSTER_NAME}-agent-1" \
"k3d-${CLUSTER_NAME}-serverlb" \
--format '{{.Name}} restart={{.HostConfig.RestartPolicy.Name}} status={{.State.Status}}'
bad="$(
docker inspect \
"k3d-${CLUSTER_NAME}-server-0" \
"k3d-${CLUSTER_NAME}-agent-0" \
"k3d-${CLUSTER_NAME}-agent-1" \
"k3d-${CLUSTER_NAME}-serverlb" \
--format '{{.HostConfig.RestartPolicy.Name}}' |
grep -v '^unless-stopped$' || true
)"
[[ -z "$bad" ]] || { echo "ERROR: k3d debe usar unless-stopped." >&2; exit 1; }
echo
echo "== Runner =="
docker inspect "$RUNNER_NAME" \
--format '{{.Name}} restart={{.HostConfig.RestartPolicy.Name}} status={{.State.Status}}'
[[ "$(docker inspect -f '{{.HostConfig.RestartPolicy.Name}}' "$RUNNER_NAME")" == "unless-stopped" ]]
[[ "$(docker inspect -f '{{.State.Running}}' "$RUNNER_NAME")" == "true" ]]
echo
echo "== Docker independiente =="
test ! -f /etc/systemd/system/docker.service.d/10-k3d-storage.conf
echo "OK"
echo
echo "== Timer =="
systemctl is-enabled k3d-lab-ensure.timer
systemctl is-active k3d-lab-ensure.timer
systemctl cat k3d-lab-ensure.timer | grep -E 'OnBootSec=5min|Persistent=false'
echo
echo "== Kubernetes =="
k3d cluster list
kubectl get nodes
ready="$(
kubectl get nodes \
-o jsonpath='{range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\n"}{end}' |
grep -c '^True$' || true
)"
[[ "$ready" -eq 3 ]] || { echo "ERROR: nodos Ready=${ready}, esperado=3." >&2; exit 1; }
echo
echo "OK: listo para reinicio con orden estable."