Skip to content

Commit b90d865

Browse files
committed
Refactor monitoring workflow to simplify endpoint printing; remove redundant ingress checks and streamline service status output.
1 parent f96aa68 commit b90d865

File tree

2 files changed

+12
-68
lines changed

2 files changed

+12
-68
lines changed

.github/workflows/endpoints.yml

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ jobs:
5555
APP_HOST=$(kubectl get svc ${{ inputs.app_name }}-svc -n ${{ inputs.app_namespace }} -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo 'Not found')
5656
5757
# Monitoring ingress information
58-
MONITORING_DOMAIN=$(kubectl get ingress -n ${{ inputs.monitoring_namespace }} -o jsonpath='{.items[0].spec.rules[0].host}' 2>/dev/null || echo 'Not found')
59-
INGRESS_IP=$(kubectl get ingress -n ${{ inputs.monitoring_namespace }} -o jsonpath='{.items[0].status.loadBalancer.ingress[0].ip}' 2>/dev/null || echo '')
60-
INGRESS_HOSTNAME=$(kubectl get ingress -n ${{ inputs.monitoring_namespace }} -o jsonpath='{.items[0].status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo '')
58+
NGINX_HOSTNAME=$(kubectl get svc -n ingress-nginx ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
6159
6260
# NGINX ingress controller LoadBalancer
6361
NGINX_LB=$(kubectl get svc -n ingress-nginx ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo 'Not found')
@@ -67,48 +65,23 @@ jobs:
6765
echo "🌟 App: http://$APP_HOST"
6866
echo ""
6967
echo "📊 Monitoring Services (via Ingress):"
70-
if [ "$MONITORING_DOMAIN" != "Not found" ]; then
71-
echo " Domain: $MONITORING_DOMAIN"
72-
echo " 📊 Prometheus: http://$MONITORING_DOMAIN/prometheus"
73-
echo " 📈 Grafana: http://$MONITORING_DOMAIN/grafana"
74-
echo " 🚨 Alertmanager: http://$MONITORING_DOMAIN/alertmanager"
75-
echo ""
76-
echo " Ingress Status:"
77-
[ ! -z "$INGRESS_IP" ] && echo " IP: $INGRESS_IP"
78-
[ ! -z "$INGRESS_HOSTNAME" ] && echo " LoadBalancer: $INGRESS_HOSTNAME"
79-
else
80-
echo " ⚠️ Ingress not found or not ready"
68+
if [ "$NGINX_HOSTNAME" != "Not found" ]; then
69+
echo " Domain: $NGINX_HOSTNAME"
70+
echo " 📊 Prometheus: http://$NGINX_HOSTNAME/prometheus"
71+
echo " 📈 Grafana: http://$NGINX_HOSTNAME/grafana"
72+
echo " 🚨 Alertmanager: http://$NGINX_HOSTNAME/alertmanager"
8173
fi
82-
8374
echo ""
8475
echo "🌐 NGINX Ingress Controller: $NGINX_LB"
8576
86-
echo ""
87-
echo "================= DETAILED INGRESS STATUS ================="
88-
echo "All Ingress Resources:"
89-
kubectl get ingress -A -o wide 2>/dev/null || echo "No ingress resources found"
90-
echo ""
91-
echo "Monitoring Namespace Ingress Details:"
92-
kubectl describe ingress -n ${{ inputs.monitoring_namespace }} 2>/dev/null || echo "No ingress in monitoring namespace"
93-
94-
echo ""
95-
echo "================= SERVICE STATUS ================="
96-
echo "Monitoring Services (should be ClusterIP):"
97-
kubectl get svc -n ${{ inputs.monitoring_namespace }} -l app.kubernetes.io/instance=kube-prometheus-stack 2>/dev/null || echo "No monitoring services found"
98-
99-
echo ""
100-
echo "All LoadBalancer Services:"
101-
kubectl get svc -A --field-selector spec.type=LoadBalancer -o wide 2>/dev/null || echo "No LoadBalancer services found"
102-
103-
echo ""
104-
echo "NGINX Ingress Controller Status:"
105-
kubectl get svc -n ingress-nginx -o wide 2>/dev/null || echo "NGINX Ingress Controller not found"
106-
10777
echo ""
10878
echo "================= DEFAULT CREDENTIALS ================="
10979
ARGOCD_PASS=$(kubectl -n ${{ inputs.argocd_namespace }} get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' 2>/dev/null | base64 -d || echo 'Not found')
11080
echo "ArgoCD -> Username: admin"
11181
echo "ArgoCD -> Password: $ARGOCD_PASS"
11282
echo "Grafana -> Username: admin"
113-
echo "Grafana -> Password: ${{ secrets.GRAFANA_PASSWORD }}"
114-
echo "Prometheus -> No login needed (anonymous access by default)"
83+
echo "Grafana -> Password: (stored in GitHub Secrets, not printed)"
84+
echo "Prometheus -> No login needed (anonymous access by default)"
85+
echo "Alertmanager -> No login needed (anonymous access by default)"
86+
echo ""
87+
echo "⚠️ Note: It may take a few minutes for LoadBalancer endpoints to become fully available after deployment."

.github/workflows/monitoring.yml

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -93,33 +93,4 @@ jobs:
9393
export ARGOCD_NAMESPACE=${{ inputs.argocd_namespace }}
9494
envsubst < ./argocd/monitoring.yml | \
9595
sed "s/monitoring\.yourdomain\.com/${{ steps.nginx-lb.outputs.nginx_hostname }}/g" | \
96-
kubectl apply -f -
97-
98-
- name: Wait for Monitoring Ingress and Print Endpoints
99-
run: |
100-
# Wait for monitoring ingress
101-
MONITORING_INGRESS=""
102-
for i in {1..30}; do
103-
MONITORING_INGRESS=$(kubectl get ingress -n ${{ inputs.monitoring_namespace }} -o jsonpath='{.items[0].status.loadBalancer.ingress[0].hostname}' 2>/dev/null)
104-
if [[ ! -z "$MONITORING_INGRESS" ]]; then
105-
echo "Monitoring ingress is ready: $MONITORING_INGRESS"
106-
break
107-
else
108-
echo "Waiting for monitoring ingress to be ready ($i/30)..."
109-
sleep 10
110-
fi
111-
done
112-
113-
# Print all service endpoints
114-
ARGOCD_HOST=$(kubectl get svc argocd-server -n ${{ inputs.argocd_namespace }} -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo 'Not found')
115-
APP_HOST=$(kubectl get svc ${{ inputs.app_name }}-svc -n ${{ inputs.app_namespace }} -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' 2>/dev/null || echo 'Not found')
116-
echo "🚀 ArgoCD: http://$ARGOCD_HOST"
117-
echo "🌟 App: http://$APP_HOST"
118-
if [[ -z "$MONITORING_INGRESS" ]]; then
119-
echo "⚠️ Monitoring Ingress not ready"
120-
else
121-
echo "📊 Monitoring Services:"
122-
echo "Prometheus: http://$MONITORING_INGRESS/prometheus"
123-
echo "Grafana: http://$MONITORING_INGRESS/grafana"
124-
echo "Alertmanager: http://$MONITORING_INGRESS/alertmanager"
125-
fi
96+
kubectl apply -f -

0 commit comments

Comments
 (0)