refactor: migrar GitLab → Gitea (aulas 10, 11, 13)

- Aula 10: Gitea + Registry + Actions + Runner (substituiu GitLab)
  - gitea-values.yaml: PostgreSQL standalone, Valkey standalone, ~800Mi RAM
  - setup.sh/cleanup.sh: namespace gitea, Helm gitea-charts/gitea + actions
  - README.md: documentação completa com de→para (GitLab/Harbor/Tekton vs Gitea)

- Aula 11: ArgoCD (GitOps) — removido GitLab Runner (runner vive na aula-10)
  - setup.sh: só ArgoCD, integração SSH com Gitea
  - node-bugado/.gitea/workflows/ci.yml: pipeline convertida

- Aula 13: Container Factory — atualizado para Gitea
  - setup.sh/cleanup.sh: referências GitLab → Gitea
  - pipelines/postgresql/ci.yml: Gitea Actions workflow
  - README.md: conexão com act_runner explicada

- CLAUDE.md: tabela de aulas atualizada
This commit is contained in:
ArgoCD Setup
2026-03-14 01:44:30 -03:00
parent ff7af56c30
commit d380cd8585
35 changed files with 3374 additions and 1202 deletions

View File

@@ -0,0 +1,188 @@
#!/bin/bash
# =============================================================================
# Benchmark LIMPO: eStargz vs Traditional Image Pull
# =============================================================================
#
# Este benchmark força execução em um node SEM cache das imagens
# para medir tempo REAL de pull.
#
# =============================================================================
set -e
NAMESPACE="benchmark-clean"
ESTARGZ_IMAGE="registry.kube.quest/factory/postgresql:17"
TRADITIONAL_IMAGE="postgres:17-alpine"
TARGET_NODE="talos-msadg4-worker-0" # Node sem cache
echo "========================================================================"
echo "Benchmark LIMPO: eStargz vs Traditional Image Pull"
echo "========================================================================"
echo ""
echo "Target node: $TARGET_NODE (sem cache de imagens)"
echo ""
echo "Comparando:"
echo " Tradicional: $TRADITIONAL_IMAGE"
echo " eStargz: $ESTARGZ_IMAGE"
echo ""
# Verificar cluster
echo "[1/6] Verificando cluster..."
kubectl cluster-info >/dev/null || { echo "ERRO: Cluster inacessível"; exit 1; }
echo " Cluster OK"
# Limpar ambiente anterior
echo "[2/6] Limpando ambiente anterior..."
kubectl delete namespace $NAMESPACE --ignore-not-found=true --wait=true 2>/dev/null || true
echo " Ambiente limpo"
# Criar namespace
echo "[3/6] Criando namespace de teste..."
kubectl create namespace $NAMESPACE
kubectl create secret docker-registry gitlab-registry \
--docker-server=registry.kube.quest \
--docker-username=root \
--docker-password="${GITLAB_TOKEN:-glpat-dummy}" \
-n $NAMESPACE 2>/dev/null || true
echo " Namespace criado"
# Teste 1: Imagem tradicional
echo ""
echo "========================================================================"
echo "[4/6] TESTE 1: Imagem Tradicional (gzip) - PULL REAL"
echo "========================================================================"
echo "Iniciando em $(date)"
T1_START=$(date +%s)
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: pg-traditional
namespace: $NAMESPACE
spec:
nodeName: $TARGET_NODE
restartPolicy: Never
containers:
- name: postgres
image: $TRADITIONAL_IMAGE
imagePullPolicy: Always
env:
- name: POSTGRES_PASSWORD
value: benchmarktest
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
EOF
kubectl wait --for=condition=Ready pod/pg-traditional -n $NAMESPACE --timeout=300s
T1_END=$(date +%s)
TIME1=$((T1_END - T1_START))
echo "Finalizado em $(date)"
echo ">>> Tempo total: ${TIME1}s <<<"
# Teste 2: Imagem eStargz
echo ""
echo "========================================================================"
echo "[5/6] TESTE 2: Imagem eStargz (lazy pulling) - PULL REAL"
echo "========================================================================"
echo "Iniciando em $(date)"
T2_START=$(date +%s)
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: pg-estargz
namespace: $NAMESPACE
spec:
nodeName: $TARGET_NODE
restartPolicy: Never
imagePullSecrets:
- name: gitlab-registry
containers:
- name: postgres
image: $ESTARGZ_IMAGE
imagePullPolicy: Always
env:
- name: POSTGRES_PASSWORD
value: benchmarktest
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
EOF
kubectl wait --for=condition=Ready pod/pg-estargz -n $NAMESPACE --timeout=300s
T2_END=$(date +%s)
TIME2=$((T2_END - T2_START))
echo "Finalizado em $(date)"
echo ">>> Tempo total: ${TIME2}s <<<"
# Resultados
echo ""
echo "========================================================================"
echo "[6/6] RESULTADOS"
echo "========================================================================"
echo ""
# Status dos pods
echo "Status dos Pods:"
kubectl get pods -n $NAMESPACE -o wide
echo ""
# Eventos completos
echo "Todos os Eventos (ordenados por tempo):"
kubectl get events -n $NAMESPACE --sort-by='.lastTimestamp' \
-o custom-columns='TIMESTAMP:.lastTimestamp,REASON:.reason,POD:.involvedObject.name,MESSAGE:.message'
echo ""
# Verificar se houve pull real
echo "Análise de Pull:"
TRAD_PULL=$(kubectl get events -n $NAMESPACE --field-selector involvedObject.name=pg-traditional,reason=Pulled -o jsonpath='{.items[0].message}' 2>/dev/null)
ESTARGZ_PULL=$(kubectl get events -n $NAMESPACE --field-selector involvedObject.name=pg-estargz,reason=Pulled -o jsonpath='{.items[0].message}' 2>/dev/null)
echo " Tradicional: $TRAD_PULL"
echo " eStargz: $ESTARGZ_PULL"
echo ""
# Tabela de resultados
echo "┌─────────────────────────────────────────────────────────────────┐"
echo "│ RESULTADOS DO BENCHMARK (PULL REAL) │"
echo "├───────────────────┬─────────────────┬─────────────────────────────┤"
echo "│ Métrica │ Tradicional │ eStargz │"
echo "├───────────────────┼─────────────────┼─────────────────────────────┤"
printf "│ Tempo até Ready │ %12ss │ %12ss │\n" "$TIME1" "$TIME2"
echo "├───────────────────┼─────────────────┼─────────────────────────────┤"
if [ "$TIME1" -gt "$TIME2" ]; then
DIFF=$((TIME1 - TIME2))
PERCENT=$(( (DIFF * 100) / TIME1 ))
echo "│ Diferença │ baseline │ -${DIFF}s (${PERCENT}% mais rápido) │"
elif [ "$TIME2" -gt "$TIME1" ]; then
DIFF=$((TIME2 - TIME1))
PERCENT=$(( (DIFF * 100) / TIME2 ))
echo "│ Diferença │ +${DIFF}s mais rápido │ baseline │"
else
echo "│ Diferença │ igual │ igual │"
fi
echo "└───────────────────┴─────────────────┴─────────────────────────────┘"
echo ""
echo "Nota: Este benchmark usou imagePullPolicy: Always no node '$TARGET_NODE'"
echo " que não tinha as imagens em cache, forçando pull real."
echo ""
echo "O benefício do eStargz (lazy pulling) é mais significativo em:"
echo " - Imagens maiores (1GB+)"
echo " - Scale-out events (novos nodes)"
echo " - Cold starts"
echo ""
echo "Para limpar: kubectl delete namespace $NAMESPACE"