- Aula 08: nginx-ingress TCP passthrough gitlab→gitea, comments
- Aula 09: add-client.sh API GitLab→Gitea
- Aula 11: node-bugado deployment image registry.kube.quest→gitea.kube.quest
- Aula 12: setup.sh/cleanup.sh API GitLab→Gitea, ArgoCD repoURL
- Aula 13: k8s manifests, benchmarks: registry.kube.quest→gitea.kube.quest,
gitlab-registry→gitea-registry, GITLAB_TOKEN→GITEA_TOKEN
- Aula 14: comments GitLab→Gitea
- README raiz: arquitetura, tabela, DNS
117 lines
3.9 KiB
Bash
Executable File
117 lines
3.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# ============================================================================
|
|
# Aula 14 - Cleanup do Istio Traffic Splitting
|
|
# ============================================================================
|
|
# Remove todos os componentes instalados pelo setup.sh:
|
|
# - Namespace istio (aplicação)
|
|
# - Kiali, Jaeger (addons)
|
|
# - Istio (istiod + base)
|
|
# - Ingress resources
|
|
#
|
|
# Mantém:
|
|
# - Cluster Kubernetes
|
|
# - Gitea e Registry (aula-10)
|
|
# - Outros namespaces
|
|
# ============================================================================
|
|
|
|
set -e
|
|
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
CYAN='\033[0;36m'
|
|
NC='\033[0m'
|
|
|
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
log_success() { echo -e "${GREEN}[OK]${NC} $1"; }
|
|
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
|
log_error() { echo -e "${RED}[ERRO]${NC} $1"; }
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
echo ""
|
|
echo -e "${CYAN}╔═══════════════════════════════════════════════════════════╗${NC}"
|
|
echo -e "${CYAN}║ Cleanup - Aula 14 Istio Traffic Splitting ║${NC}"
|
|
echo -e "${CYAN}╚═══════════════════════════════════════════════════════════╝${NC}"
|
|
echo ""
|
|
echo -e "${YELLOW}Este script irá remover:${NC}"
|
|
echo " - Namespace 'istio' com aplicação"
|
|
echo " - Addons: Kiali, Jaeger"
|
|
echo " - Istio: istiod e istio-base"
|
|
echo " - Ingress do Kiali e Jaeger"
|
|
echo ""
|
|
read -p "Continuar? (digite 'sim' para confirmar): " confirm
|
|
if [[ "$confirm" != "sim" ]]; then
|
|
log_info "Operação cancelada"
|
|
exit 0
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Remover pod de teste
|
|
log_info "Removendo pod de teste..."
|
|
kubectl delete pod curl-test -n istio --ignore-not-found=true 2>/dev/null || true
|
|
|
|
# Remover namespace istio (aplicação demo)
|
|
if kubectl get namespace istio &> /dev/null; then
|
|
log_info "Removendo namespace istio..."
|
|
kubectl delete namespace istio --wait=false 2>/dev/null || true
|
|
log_success "Namespace istio marcado para remoção"
|
|
else
|
|
log_info "Namespace istio não encontrado"
|
|
fi
|
|
|
|
# Remover Ingress
|
|
log_info "Removendo Ingress..."
|
|
kubectl delete ingress kiali jaeger -n istio-system --ignore-not-found=true 2>/dev/null || true
|
|
log_success "Ingress removidos"
|
|
|
|
# Remover addons (Kiali, Jaeger)
|
|
log_info "Removendo Kiali..."
|
|
kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.24/samples/addons/kiali.yaml 2>/dev/null || true
|
|
|
|
log_info "Removendo Jaeger..."
|
|
kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.24/samples/addons/jaeger.yaml 2>/dev/null || true
|
|
log_success "Addons removidos"
|
|
|
|
# Remover istiod
|
|
if helm status istiod -n istio-system &> /dev/null; then
|
|
log_info "Removendo istiod..."
|
|
helm uninstall istiod -n istio-system --wait
|
|
log_success "istiod removido"
|
|
else
|
|
log_info "istiod não encontrado"
|
|
fi
|
|
|
|
# Remover istio-base
|
|
if helm status istio-base -n istio-system &> /dev/null; then
|
|
log_info "Removendo istio-base..."
|
|
helm uninstall istio-base -n istio-system --wait
|
|
log_success "istio-base removido"
|
|
else
|
|
log_info "istio-base não encontrado"
|
|
fi
|
|
|
|
# Remover namespace istio-system
|
|
if kubectl get namespace istio-system &> /dev/null; then
|
|
log_info "Removendo namespace istio-system..."
|
|
kubectl delete namespace istio-system --wait=false 2>/dev/null || true
|
|
log_success "Namespace istio-system marcado para remoção"
|
|
fi
|
|
|
|
# Remover arquivo .env
|
|
echo ""
|
|
read -p "Remover arquivo .env? [s/N]: " remove_env
|
|
if [[ "$remove_env" == "s" || "$remove_env" == "S" ]]; then
|
|
rm -f "${SCRIPT_DIR}/.env"
|
|
log_success "Arquivo .env removido"
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${GREEN}Cleanup concluído.${NC}"
|
|
echo ""
|
|
echo "Aguarde alguns minutos para os namespaces serem removidos completamente."
|
|
echo "Verificar: kubectl get ns"
|
|
echo ""
|