Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OIDC support #126

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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(

Check warning on line 138 in kr8s/_auth.py

View check run for this annotation

Codecov / codecov/patch

kr8s/_auth.py#L137-L138

Added lines #L137 - L138 were not covered by tests
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"]

Check warning on line 143 in kr8s/_auth.py

View check run for this annotation

Codecov / codecov/patch

kr8s/_auth.py#L143

Added line #L143 was not covered by tests

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