Skip to content

Commit

Permalink
Add OIDC support (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson committed Jul 25, 2023
1 parent 053f91c commit 7e6765c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kr8s/_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ async def _load_kubeconfig(self) -> None:
self.password = self._user["password"]
if self.namespace is None:
self.namespace = self._context.get("namespace", "default")
# TODO: Handle auth-provider oidc auth
if "auth-provider" in self._user:
if p := self._user["auth-provider"]["name"] != "oidc":
raise ValueError(
f"auth-provider {p} was deprecated in Kubernetes 1.21 "
"and is not supported by kr8s"
)
# TODO: Handle refreshing OIDC token if missing or expired
self.token = self._user["auth-provider"]["config"]["id-token"]

async def _load_service_account(self) -> None:
"""Load credentials from service account."""
Expand Down

0 comments on commit 7e6765c

Please sign in to comment.