From 35523a1c1bbc470b4a73097db9cbfccd22133246 Mon Sep 17 00:00:00 2001 From: ArgoCD Setup Date: Sat, 24 Jan 2026 00:23:09 -0300 Subject: [PATCH] fix(aula-10): corrigir certificados e ingress do GitLab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mesclar seções global duplicadas no gitlab-values.yaml (a segunda sobrescrevia ingress.class: nginx, causando 404) - Adicionar etapa de DNS antes da instalação no setup.sh (HTTP-01 challenge requer DNS configurado previamente) --- aula-10/gitlab-values.yaml | 22 +++++++-------- aula-10/setup.sh | 55 +++++++++++++++++++++++++++++++------- 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/aula-10/gitlab-values.yaml b/aula-10/gitlab-values.yaml index a0374dc..403fabd 100644 --- a/aula-10/gitlab-values.yaml +++ b/aula-10/gitlab-values.yaml @@ -52,6 +52,17 @@ global: seccompProfile: type: RuntimeDefault + # Object Storage - Hetzner S3 (em vez de MinIO) + minio: + enabled: false + appConfig: + object_store: + enabled: true + proxy_download: true + connection: + secret: gitlab-object-storage + key: connection + # Email (opcional - configurar depois) # email: # from: gitlab@kube.quest @@ -234,17 +245,6 @@ redis: minio: install: false -global: - minio: - enabled: false - appConfig: - object_store: - enabled: true - proxy_download: true - connection: - secret: gitlab-object-storage - key: connection - # ============================================================================= # REGISTRY (Container Registry) # ============================================================================= diff --git a/aula-10/setup.sh b/aula-10/setup.sh index 02280bf..b986df6 100755 --- a/aula-10/setup.sh +++ b/aula-10/setup.sh @@ -463,7 +463,41 @@ collect_user_input echo "" # ============================================================================= -# 3. INSTALAR CERT-MANAGER (se Let's Encrypt) +# 3. MOSTRAR DNS E AGUARDAR CONFIGURAÇÃO (ANTES DO GITLAB!) +# ============================================================================= +# IMPORTANTE: Para Let's Encrypt funcionar, o DNS precisa estar configurado +# ANTES da instalação do GitLab. O HTTP-01 challenge requer que: +# 1. O DNS aponte para o LoadBalancer +# 2. O cert-manager crie o pod acme-http-solver +# 3. Let's Encrypt acesse http://dominio/.well-known/acme-challenge/token + +log_info "=== Configuração de DNS ===" + +show_dns_instructions + +echo "" +echo -e "${YELLOW}════════════════════════════════════════════════════════════════${NC}" +echo -e "${YELLOW} IMPORTANTE: Configure o DNS AGORA antes de continuar!${NC}" +echo -e "${YELLOW}════════════════════════════════════════════════════════════════${NC}" +echo "" +if [[ "$USE_LETSENCRYPT" == "true" ]]; then + echo -e "O Let's Encrypt precisa que o DNS já esteja configurado para" + echo -e "validar o domínio via HTTP-01 challenge." + echo "" +fi +echo -n "Pressione ENTER após configurar o DNS (ou 's' para pular): " +read -r dns_confirm + +if [[ "$dns_confirm" == "s" || "$dns_confirm" == "S" ]]; then + log_warn "DNS não configurado - certificados podem falhar!" +else + log_success "DNS confirmado pelo usuário" +fi + +echo "" + +# ============================================================================= +# 4. INSTALAR CERT-MANAGER (se Let's Encrypt) # ============================================================================= if [[ "$USE_LETSENCRYPT" == "true" ]]; then @@ -474,7 +508,7 @@ if [[ "$USE_LETSENCRYPT" == "true" ]]; then fi # ============================================================================= -# 4. ADICIONAR REPOSITÓRIO HELM +# 5. ADICIONAR REPOSITÓRIO HELM # ============================================================================= log_info "=== Preparando instalação do GitLab ===" @@ -484,7 +518,7 @@ helm repo add gitlab https://charts.gitlab.io/ 2>/dev/null || true helm repo update # ============================================================================= -# 5. CRIAR NAMESPACE +# 6. CRIAR NAMESPACE # ============================================================================= log_info "Criando namespace gitlab..." @@ -493,7 +527,7 @@ kubectl create namespace gitlab --dry-run=client -o yaml | kubectl apply -f - echo "" # ============================================================================= -# 6. CRIAR SECRETS DO OBJECT STORAGE +# 7. CRIAR SECRETS DO OBJECT STORAGE # ============================================================================= create_object_storage_secrets @@ -501,7 +535,7 @@ create_object_storage_secrets echo "" # ============================================================================= -# 7. INSTALAR GITLAB VIA HELM +# 8. INSTALAR GITLAB VIA HELM # ============================================================================= log_info "=== Instalando GitLab (isso pode levar 10-15 minutos) ===" @@ -573,7 +607,7 @@ fi echo "" # ============================================================================= -# 7. CONFIGURAR TCP PASSTHROUGH PARA SSH +# 9. CONFIGURAR TCP PASSTHROUGH PARA SSH # ============================================================================= log_info "=== Configurando TCP passthrough para SSH ===" @@ -598,7 +632,7 @@ log_success "TCP passthrough configurado (porta 22 → GitLab Shell)" echo "" # ============================================================================= -# 8. OBTER SENHA INICIAL +# 10. OBTER SENHA INICIAL # ============================================================================= log_info "Obtendo senha inicial do root..." @@ -676,8 +710,11 @@ else echo " -o jsonpath='{.data.password}' | base64 -d; echo" fi -# Mostrar instruções de DNS -show_dns_instructions +# Lembrete de DNS (referência) +echo "" +echo -e "${CYAN}Lembrete DNS:${NC}" +echo " ${GITLAB_HOST} → LoadBalancer IP" +echo " ${REGISTRY_HOST} → LoadBalancer IP" echo "" echo "Comandos úteis:"