Skip to content

feat: add script to verify Argo CD service labels for auto-detection #423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions scripts/verify-argocd-auto-detection.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Check if NAMESPACE is set
if [ -z "$NAMESPACE" ]; then
echo "❌ ERROR: NAMESPACE environment variable is not set."
echo "Please set the NAMESPACE environment variable and try again."
echo "Example: NAMESPACE=argocd ./verify-argocd-auto-detection.sh"
exit 1
fi

echo "Checking Argo CD service labels in namespace '$NAMESPACE'..."
S=$(kubectl get svc -n "$NAMESPACE" -l app.kubernetes.io/component=server,app.kubernetes.io/part-of=argocd -o name 2>/dev/null)
R=$(kubectl get svc -n "$NAMESPACE" -l app.kubernetes.io/component=repo-server,app.kubernetes.io/part-of=argocd -o name 2>/dev/null)
D=$(kubectl get svc -n "$NAMESPACE" -l app.kubernetes.io/component=redis,app.kubernetes.io/part-of=argocd -o name 2>/dev/null)
[ -z "$S" ] && echo "❌ Server: NOT FOUND" || echo "✅ Server: Found"
[ -z "$R" ] && echo "❌ Repo: NOT FOUND" || echo "✅ Repo: Found"
[ -z "$D" ] && echo "❌ Redis: NOT FOUND" || echo "✅ Redis: Found"
if [ -n "$S" ] && [ -n "$R" ] && [ -n "$D" ]; then
echo "✅ SUCCESS: All Argo CD services have proper labels for auto-detection."
else
echo "❌ ISSUE: Missing services in namespace '$NAMESPACE'. Required labels:"
echo "- Server: app.kubernetes.io/component=server,app.kubernetes.io/part-of=argocd"
echo "- Repo: app.kubernetes.io/component=repo-server,app.kubernetes.io/part-of=argocd"
echo "- Redis: app.kubernetes.io/component=redis,app.kubernetes.io/part-of=argocd"
fi