-
-
Save sturman/9d585e04bd9870d0a60e27b61cf3814a to your computer and use it in GitHub Desktop.
update password for argocd user
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
#!/usr/bin/env bash | |
# https://argoproj.github.io/argo-cd/faq/#i-forgot-the-admin-password-how-do-i-reset-it | |
username=$1 | |
password=$2 | |
if [[ -z $username || -z $password ]]; then | |
echo "Usage: $0 \$username \$password" | |
echo "Missing username or password argument" | |
exit 1 | |
fi | |
bcrypted=$(htpasswd -nbBC 10 ${username} ${password}) | |
bcrypted_pass=${bcrypted#*:} | |
date=$(date +%FT%T%Z) | |
echo 'Updating password for "'${username}'" to "'${password}'" at '${date}'' | |
set -x | |
kubectl -n argocd patch secret argocd-secret -p '{"stringData" : { "'${username}.password'": "'${bcrypted_pass}'", "'${username}'.passwordMtime": "'${date}'" }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment