From ace6d055b6e0ba1e3177196befeddbc58a052b7b Mon Sep 17 00:00:00 2001 From: joereg4 Date: Sun, 21 Sep 2025 14:21:57 -0500 Subject: [PATCH] Enhance Kubernetes workflow with error pod checks and update load-graphql image - Added checks for failed or error pods in the Kubernetes workflow, providing logs for troubleshooting. -image: debian:buster is end of life. Updated the load-graphql job to use the debian:bullseye image for improved compatibility. --- .github/workflows/docker-k8s.yml | 13 +++++++++++-- Resources/k8s/kustomize/base/jobs/load-graphql.yaml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-k8s.yml b/.github/workflows/docker-k8s.yml index 6e8ae4b4..ca9c0ead 100644 --- a/.github/workflows/docker-k8s.yml +++ b/.github/workflows/docker-k8s.yml @@ -82,8 +82,6 @@ jobs: make kustomize-local-apply echo "=== Verifying job creation ===" kubectl get jobs -n pokeapi - echo "=== Checking if load-graphql job exists ===" - kubectl get job load-graphql -n pokeapi || echo "Job not found - this is the problem!" kubectl proxy & sleep 1 bash Resources/scripts/wait.sh http://localhost:8001/api/v1/namespaces/pokeapi/services/pokeapi/proxy/api/v2/ @@ -121,6 +119,17 @@ jobs: kubectl logs -l component=pokeapi -n pokeapi --tail=10 || echo "No PokeAPI logs yet" echo "=== Checking if pal-park-area data exists ===" kubectl exec -n pokeapi deployment/pokeapi -- python manage.py shell -c "from pokemon_v2.models import PalParkArea; print(f'PalParkArea count: {PalParkArea.objects.count()}')" || echo "Failed to check PalParkArea data" + echo "=== Checking for failed/error pods ===" + error_pods=$(kubectl get pods -n pokeapi -o jsonpath='{.items[?(@.status.phase=="Failed" || @.status.phase=="Error")].metadata.name}') + if [ -n "$error_pods" ]; then + echo "Found error/failed pods, showing logs:" + for pod in $error_pods; do + echo "=== Logs for $pod ===" + kubectl logs $pod -n pokeapi --tail=50 || echo "No logs available for $pod" + done + else + echo "No error/failed pods found" + fi - name: Debug network connectivity run: | diff --git a/Resources/k8s/kustomize/base/jobs/load-graphql.yaml b/Resources/k8s/kustomize/base/jobs/load-graphql.yaml index cf978a10..9bb8b28f 100644 --- a/Resources/k8s/kustomize/base/jobs/load-graphql.yaml +++ b/Resources/k8s/kustomize/base/jobs/load-graphql.yaml @@ -18,7 +18,7 @@ spec: done; containers: - name: load-graphql - image: debian:buster + image: debian:bullseye env: - name: HASURA_GRAPHQL_ADMIN_SECRET valueFrom: