common.sh 923 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. print_title() {
  3. echo "============================================"
  4. echo "$1"
  5. echo "============================================"
  6. }
  7. print_success() {
  8. echo "✅ $1"
  9. }
  10. print_error() {
  11. echo "❌ $1"
  12. }
  13. print_warning() {
  14. echo "⚠️ $1"
  15. }
  16. print_info() {
  17. echo "🔹 $1"
  18. }
  19. print() {
  20. echo "$1"
  21. }
  22. # Check dependencies
  23. check_dependencies(){
  24. print "Checking dependencies..."
  25. command -v kubectl >/dev/null 2>&1 || { print "Error: kubectl command not found"; exit 1; }
  26. command -v helm >/dev/null 2>&1 || { print "Error: helm command not found"; exit 1; }
  27. # Check if Kubernetes is available
  28. print "Checking if Kubernetes is available..."
  29. kubectl cluster-info &>/dev/null
  30. if [ $? -ne 0 ]; then
  31. print "Error: Kubernetes cluster is not accessible. Please ensure you have proper access to a Kubernetes cluster."
  32. exit 1
  33. fi
  34. print_success "Kubernetes cluster is accessible."
  35. }