zarya/cmd/flux.sh

28 lines
1.2 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -uo pipefail
ZARYA_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "${ZARYA_DIR}/lib/common.sh"
subcmd="${1:-status}"
shift || true
case "${subcmd}" in
sync|reconcile|s)
log_info "Принудительная конвергенция FluxCD..."
flux reconcile source git atlas-repo -n flux-system 2>/dev/null || true
flux reconcile kustomization infra-sync -n flux-system 2>/dev/null || true
flux reconcile kustomization apps-sync -n flux-system 2>/dev/null || true
log_ok "Синхронизация завершена."
;;
logs|log|l)
log_info "Стриминг логов kustomize-controller..."
exec kubectl -n flux-system logs -l app.kubernetes.io/name=kustomize-controller --tail=50 -f
;;
status|st)
echo -e "${BLUE}=== СТАТУС РЕПОЗИТОРИЕВ И KUSTOMIZATION (FLUX) ===${NC}"
kubectl -n flux-system get gitrepositories,kustomizations,helmreleases 2>/dev/null || log_err "Flux недоступен"
;;
*)
kubectl -n flux-system get kustomizations 2>/dev/null || log_err "Flux недоступен"
;;
esac