prole/tmp/restart_gitlab_pods.sh

21 lines
641 B
Bash

#!/usr/bin/env bash
set -euo pipefail
export KUBECONFIG=/Users/chrisfu/dev/knoe/knoe-k3s.kubeconfig
echo "==> Deleting failed jobs..."
kubectl -n gitlab delete jobs --all --ignore-not-found
echo "==> Deleting crashed/stuck GitLab pods..."
kubectl -n gitlab delete pods \
-l 'app in (toolbox,registry,gitaly,webservice,sidekiq,gitlab-exporter,minio)' \
--ignore-not-found
echo "==> Waiting 120s for operator to reconcile and pods to start..."
sleep 120
echo "==> Pod status:"
kubectl -n gitlab get pods --sort-by=.metadata.creationTimestamp | grep -v jemalloc-builder
echo "==> GitLab CR status:"
kubectl -n gitlab get gitlab gitlab