feat(k8s): add reset-auth sub-command to freeleaps-cluster-authenticator for resetting kubectl authentication state
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
8598d92c01
commit
614f6b8683
@ -24,6 +24,7 @@ help() {
|
||||
echo ""
|
||||
echo "Sub Commands:"
|
||||
echo " auth,-a,--auth Setup kubectl for freeleaps cluster with Mathmast account."
|
||||
echo " reset-auth,-r,--reset-auth Reset kubectl authentication state for freeleaps cluster."
|
||||
echo " clear,-c,--clear Clear authentication for freeleaps cluster."
|
||||
echo " doctor,-d,--doctor Check if all the required tools are installed."
|
||||
echo " help,-h,--help Show this help message."
|
||||
@ -267,6 +268,12 @@ clear_auth() {
|
||||
echo "[CLEAR] kubectl authentication cleared successfully."
|
||||
}
|
||||
|
||||
reset_auth() {
|
||||
echo "[RESET] Reset kubectl authentication state..."
|
||||
rm -rf "${HOME}/.kube/oidc-login"
|
||||
echo "[RESET] kubectl authentication state reset successfully."
|
||||
}
|
||||
|
||||
main() {
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "[ERROR] No sub-command provided."
|
||||
@ -281,6 +288,9 @@ main() {
|
||||
auth|-a|--auth)
|
||||
auth
|
||||
;;
|
||||
reset-auth|-r|--reset-auth)
|
||||
reset_auth
|
||||
;;
|
||||
clear|-c|--clear)
|
||||
clear_auth
|
||||
;;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user