Last active
November 27, 2023 17:49
-
-
Save mreider/c0d716ade82aeac45aeb794a726996c2 to your computer and use it in GitHub Desktop.
Argo Setup and OTel Demo Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$(uname)" != "Darwin" ]]; then | |
echo "This script is intended for macOS only." | |
exit 1 | |
fi | |
# Check if Homebrew is installed | |
if ! command -v brew &> /dev/null; then | |
echo "Homebrew is not installed. Please install Homebrew first." | |
exit 1 | |
fi | |
# Deploy ArgoCD | |
kubectl create namespace argocd | |
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml | |
# Install ArgoCD CLI | |
brew install argocd | |
# Patch service for a load balancer | |
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}' | |
# Wait for the service to get an external IP. This can take a few minutes. | |
echo "Waiting for LoadBalancer IP..." | |
while : ; do | |
ARGOCD_IP=$(kubectl get svc argocd-server -n argocd -o=jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null) | |
if [[ -n "$ARGOCD_IP" ]]; then | |
break | |
fi | |
sleep 10 | |
done | |
# Set the IP address as an env variable | |
export ARGOCD_URL=$ARGOCD_IP.nip.io | |
echo "ArgoCD URL is set to $ARGOCD_URL" | |
# Prompt for ArgoCD admin passwords | |
read -sp 'Enter the current ArgoCD admin password: ' OLD_PASSWORD | |
echo | |
read -sp 'Enter the new ArgoCD admin password: ' NEW_PASSWORD | |
echo | |
# Variables for ArgoCD | |
ARGOCD_USER=admin | |
# Login to Argo CD | |
argocd login $ARGOCD_URL --username $ARGOCD_USER --password $OLD_PASSWORD --insecure | |
# Check if login was successful | |
if [ $? -eq 0 ]; then | |
# Update password | |
argocd account update-password --current-password $OLD_PASSWORD --new-password $NEW_PASSWORD | |
if [ $? -eq 0 ]; then | |
echo "Password updated successfully." | |
else | |
echo "Failed to update the password." | |
fi | |
else | |
echo "Login failed. Check your credentials or server URL." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment