diff --git a/cluster/bin/infra-auth-retriver b/cluster/bin/infra-auth-retriver new file mode 100755 index 00000000..4f15c464 --- /dev/null +++ b/cluster/bin/infra-auth-retriver @@ -0,0 +1,47 @@ +#!/bin/sh + +set -eu + +VERSION="0.0.1-20250115" + +help() { + echo "Freeleaps Cluster Auth Retriever (Version: ${VERSION})" + echo "" + echo "FYI: This script is used to retrieve the auth of the infra services, just for internal and temporary use." + echo "" + echo "Usage: infra-auth-retriver " + echo "" + echo "Sub Commands:" + echo " help,-h,--help Show help" + echo " grafana Retrieve Grafana Auth" + echo " argocd Retrieve ArgoCD Auth" +} + +main() { + if [ "$#" -ne 1 ]; then + echo "[ERROR] No sub-commands provided." + echo "[TIP] Use 'infra-auth-retriver help' to get more information." + exit 1 + fi + + sub_command="$1" + + case "${sub_command}" in + help|-h|--help) + help + ;; + grafana) + echo "Grafana User: $(kubectl get secret kube-prometheus-stack-grafana -n freeleaps-monitoring-system -o jsonpath='{.data.admin-user}' | base64 -d)" + echo "Grafana Password: $(kubectl get secret kube-prometheus-stack-grafana -n freeleaps-monitoring-system -o jsonpath='{.data.admin-password}' | base64 -d)" + ;; + argocd) + echo "ArgoCD User: admin" + echo "ArgoCD Auth: $(kubectl get secret argocd-initial-admin-secret -n freeleaps-devops-system -o jsonpath='{.data.password}' | base64 -d)" + ;; + *) + help + ;; + esac +} + +main "$@" \ No newline at end of file