prole/tmp/check_and_fix_dirs.sh

23 lines
1.0 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
export KUBECONFIG=/Users/chrisfu/dev/knoe/knoe-k3s.kubeconfig
echo "==> Verify dirs on gandalf..."
kubectl -n gitlab run dircheck \
--image=alpine:latest --restart=Never --rm --attach \
--overrides='{
"spec":{"nodeName":"gandalf.knoe.org","tolerations":[{"operator":"Exists"}],
"volumes":[{"name":"syn","hostPath":{"path":"/synology/d005","type":"Directory"}}],
"containers":[{"name":"dircheck","image":"alpine:latest",
"command":["sh","-c","ls -la /syn/gitlab/ 2>&1 || echo DIR_MISSING; mkdir -p /syn/gitlab/minio /syn/gitlab/gitaly && chmod 777 /syn/gitlab/minio /syn/gitlab/gitaly && echo CREATED && ls -la /syn/gitlab/"],
"volumeMounts":[{"name":"syn","mountPath":"/syn"}]}]}}' 2>&1
echo "==> Force rescheduling minio pod..."
kubectl -n gitlab delete pod gitlab-minio-5459cf9679-7nv6c --ignore-not-found
echo "==> Waiting 60s..."
sleep 60
echo "==> Status:"
kubectl -n gitlab get pods --sort-by=.metadata.creationTimestamp | grep -v jemalloc-builder