diff --git a/.gitignore b/.gitignore index 59516a6..7f5d09f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ bin dex-k8s-authenticator !charts/dex-k8s-authenticator .idea +examples/dex.db diff --git a/templates/linux-mac-common.html b/templates/linux-mac-common.html index d0760a9..4292f0d 100644 --- a/templates/linux-mac-common.html +++ b/templates/linux-mac-common.html @@ -58,19 +58,22 @@
kubectl config set-credentials {{ .Username }}-{{ .ClusterName }} \
- --exec-api-version=client.authentication.k8s.io/v1beta1 \
- --exec-command=kubectl \
- --exec-arg=oidc-login \
- --exec-arg=get-token \
- --exec-arg=--listen-address=127.0.0.1:18000 \
- --exec-arg=--oidc-issuer-url={{ .Issuer }} \
- --exec-arg=--oidc-client-id={{ .ClientID }} \
+ # Delete existing user (if it exists)
+kubectl config delete-user {{ .Username }}-{{ .ClusterName }} || true
+
+kubectl config set-credentials {{ .Username }}-{{ .ClusterName }} \
+ --exec-api-version=client.authentication.k8s.io/v1beta1 \
+ --exec-command=kubectl \
+ --exec-arg=oidc-login \
+ --exec-arg=get-token \
+ --exec-arg=--listen-address=127.0.0.1:18000 \
+ --exec-arg=--oidc-issuer-url={{ .Issuer }} \
+ --exec-arg=--oidc-client-id={{ .ClientID }} \
{{- if .ClientSecret }}
- --exec-arg=--oidc-client-secret={{ .ClientSecret }} \
+ --exec-arg=--oidc-client-secret={{ .ClientSecret }} \
{{- end }}
- --exec-arg=--oidc-extra-scope=email \
- --exec-arg=--oidc-extra-scope=groups
+ --exec-arg=--oidc-extra-scope=email \
+ --exec-arg=--oidc-extra-scope=groups