Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa6765 committed Nov 19, 2024
1 parent 900d6f3 commit ed63ff6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 29 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,4 @@ The script offers the following operations:

- The script assumes you have the necessary permissions in your Kubernetes cluster.
- Port-forwarding (option 3) will run in the background. Press Enter to stop it when you're done.
- After adding a load balancer (option 4), it may take a few minutes for an external IP to be assigned.

## Contributing

Contributions to improve the script or documentation are welcome. Please feel free to submit a pull request or open an issue for any bugs or feature requests.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
- After adding a load balancer (option 4), it may take a few minutes for an external IP to be assigned.
46 changes: 26 additions & 20 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ install_argocd() {

# Function to get ArgoCD secret
get_secret() {
echo "Retrieving ArgoCD admin password..."
echo "Retrieving ArgoCD admin's password..."
PASSWORD=$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d)
echo "ArgoCD admin password: $PASSWORD"
}
Expand All @@ -33,24 +33,30 @@ add_load_balancer() {
echo "Load Balancer added. It may take a few minutes for an external IP to be assigned."
}

# Main menu
while true; do
echo "ArgoCD Setup Menu:"
echo "1. Install ArgoCD"
echo "2. Get ArgoCD secret"
echo "3. Set up port-forwarding"
echo "4. Add load balancer"
echo "5. Exit"
read -p "Enter your choice (1-5): " choice
# Function to uninstall ArgoCD
uninstall_argocd() {
echo "Uninstalling ArgoCD..."
kubectl delete -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl delete namespace argocd
echo "ArgoCD uninstalled successfully."
}

case $choice in
1) install_argocd ;;
2) get_secret ;;
3) setup_port_forward ;;
4) add_load_balancer ;;
5) echo "Exiting..."; exit 0 ;;
*) echo "Invalid option. Please try again." ;;
esac
# Main menu
echo "ArgoCD Setup Menu:"
echo "1. Install ArgoCD"
echo "2. Get ArgoCD secret"
echo "3. Set up port-forwarding"
echo "4. Add load balancer"
echo "5. Uninstall ArgoCD"
echo "6. Exit"
read -p "Enter your choice (1-6): " choice

echo
done
case $choice in
1) install_argocd ;;
2) get_secret ;;
3) setup_port_forward ;;
4) add_load_balancer ;;
5) uninstall_argocd ;;
6) echo "Exiting..."; exit 0 ;;
*) echo "Invalid option." ;;
esac

0 comments on commit ed63ff6

Please sign in to comment.