#!/usr/bin/env bash
# 用途：檢查 {{APP_NAME}} 狀態

set -euo pipefail

APP_NAME="{{APP_NAME}}"

echo "=== [ $APP_NAME 資源狀態 ] ==="
echo ""

# 1. Pods
echo "--- Pods ---"
kubectl get pods -l "app=$APP_NAME" -o wide

echo ""

# 2. Services
echo "--- Services ---"
kubectl get svc -l "app=$APP_NAME"

echo ""

# 3. PVC
echo "--- Storage (PVC) ---"
kubectl get pvc | grep "$APP_NAME" || echo "無 PVC"

echo ""

# 4. Ingress
echo "--- Access (Ingress) ---"
kubectl get ingress -l "app=$APP_NAME" -o custom-columns=NAME:.metadata.name,HOSTS:.spec.rules[*].host,ADDRESS:.status.loadBalancer.ingress[*].ip
