#!/bin/bash

# Deploy script for Freeleaps PVC Backup to ArgoCD

set -e

echo "Deploying Freeleaps PVC Backup to ArgoCD..."

# Apply ArgoCD Application
echo "Applying ArgoCD Application configuration..."
kubectl apply -f argo-app/application.yaml

echo "ArgoCD Application deployed successfully!"
echo ""
echo "To check the status:"
echo "kubectl get applications -n freeleaps-devops-system"
echo ""
echo "To view ArgoCD UI:"
echo "kubectl port-forward svc/argocd-server -n freeleaps-devops-system 8080:443"
echo ""
echo "To check the CronJob after sync:"
echo "kubectl get cronjobs -n freeleaps-prod"
echo ""
echo "To view job logs:"
echo "kubectl get jobs -n freeleaps-prod"
echo "kubectl logs -n freeleaps-prod job/freeleaps-data-backup-<timestamp>" 