Skip to content

Instantly share code, notes, and snippets.

@suresh-sendinblue
Last active November 23, 2023 09:14
Show Gist options
  • Save suresh-sendinblue/7d8cd16f8916439c5a7984bd2d047c3e to your computer and use it in GitHub Desktop.
Save suresh-sendinblue/7d8cd16f8916439c5a7984bd2d047c3e to your computer and use it in GitHub Desktop.
#!/bin/bash
set -x
kubeserver=$1
KUBECONFIG=$2
SA_TOKEN=$3
client_domain=$4
if (test -f $KUBECONFIG && ! test -f $SA_TOKEN); then
if curl -s --insecure --connect-timeout 10 $kubeserver > /dev/null; then
echo "$KUBESERVER is able to connect";
kubectl --kubeconfig $KUBECONFIG create serviceaccount argocd-sa -n kube-system
kubectl --kubeconfig $KUBECONFIG create token argocd-sa -n kube-system --audience https://$client_domain > $SA_TOKEN;
else
echo "Connection refused: $KUBESERVER";
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment