Skip to content

feat(k8s): unified cloud OAuth token generation for GKE and AKS - #208

Open
JLCode-tech wants to merge 11 commits into
stagingfrom
feat/unified-cloud-k8s-access
Open

feat(k8s): unified cloud OAuth token generation for GKE and AKS#208
JLCode-tech wants to merge 11 commits into
stagingfrom
feat/unified-cloud-k8s-access

Conversation

@JLCode-tech

@JLCode-tech JLCode-tech commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Provides pure-Python OAuth token generation for GCP and Azure Kubernetes clusters, plus multi-cloud provider badges.

Key Changes

  • Token Generation: Added pure-Python OAuth token generation with fallback for GCP and Azure in credentials_service.py and kubernetes/_base.py, so the API container does not need gke-gcloud-auth-plugin or the Azure CLI to authenticate to GKE/AKS.
  • Frontend Badges & Flags: Added multi-cloud provider badges and flags for GKE and Azure in projects and dashboard views.
  • Tests: Added unit tests for Kubernetes Azure & GCP token flows.

https://claude.ai/code/session_01UCsZXDxBsWV2s4kT47DwDW

@JLCode-tech
JLCode-tech changed the base branch from main to staging September 7, 2026 02:24
@jgruberf5 jgruberf5 changed the title feat(k8s): unified cloud OAuth token generation and SSL inspection proxy resilience feat(k8s): unified cloud OAuth token generation for GKE and AKS Sep 8, 2026
…w nits

Self-review findings on feat/unified-cloud-k8s-access:

- F1 (MEDIUM): get_gcp_service_account_info / get_azure_service_principal_info
  no longer fall through to ambient os.getenv creds when a project sets an
  EXPLICIT credential_template_id whose provider mismatches (or whose creds are
  unusable). That fail-OPEN handed back the ambient global identity and defeated
  explicit template scoping. Now fail CLOSED (return None) whenever a template is
  explicitly scoped; the ambient env fallback applies ONLY when no template is
  set. Made the two guard tests hermetic (monkeypatch ambient env to sentinels)
  so they catch the regression regardless of CI env.
- F3 (nit): removed dead `import logging` + unused module logger from
  azure_oauth_service.py.
- F4 (nit): corrected the load_kubeconfig docstring to describe in-memory
  load_kube_config_from_dict instead of a temporary kubeconfig file.
- F5 (LOW): _generate_gcp_token now derives its cache TTL from the token's real
  expiry (max(60, expires_in - 300)), mirroring _generate_azure_token, instead of
  a hardcoded now + 2700.

Claude-Session: https://claude.ai/code/session_01UCsZXDxBsWV2s4kT47DwDW
@jgruberf5

Copy link
Copy Markdown
Collaborator

Self-review (cold, adversarial) + fixes applied

An independent cold audit executed the security-critical paths. No blockers — token minting mirrors the existing EKS path, encryption-at-rest is respected, no token/secret is logged, and the temp-file kubeconfig was replaced with in-memory load_kube_config_from_dict (a net improvement). Findings, all now fixed on this branch:

F1 (MEDIUM — fail-open + non-hermetic tests) — FIXED. get_gcp_service_account_info / get_azure_service_principal_info fell through to the os.getenv ambient identity when a project had an EXPLICIT but mismatched/unusable credential template — and the two guard tests only passed because CI's env happened to be empty (reproduced: exporting the ambient creds red them). Fix: compute explicit_template up front and return None (fail closed) before the env fallback whenever a template is scoped; the ambient path survives only when NO template is set (the intentional global-default). Tests are now hermetic (set the ambient vars to sentinels, assert None). Mutation-verified: the original fail-open code reds both tests with ambient creds set; the fix passes with creds set and unset (4 passed both ways). 202 passed across credentials/k8s/eks/azure.

F2 (LOW) — FIXED. Removed the "corporate-proxy SSL-interception retries" claim from the title/body — it isn't implemented (request_azure_oauth_token is a plain requests.post; _generate_gcp_token a bare Session). Did not add the feature; only corrected the description.

F3/F4 (nits) — FIXED. Removed the dead logger in azure_oauth_service.py; corrected the stale load_kubeconfig docstring (in-memory, no temp file).

F5 (LOW) — FIXED. _generate_gcp_token now derives its cache TTL from the token's real credentials.expiry (max(60, expires_in-300), guarded), matching _generate_azure_token, instead of a hardcoded 45 min.

Held clean: no secret/token leakage; Azure token cache keyed on the credential identity (no cross-identity serve); contract unchanged (no new routers/schemas). Note for merge coordination: PRs #206 and #207 also edit credentials_service.py's GCP/Azure resolvers — kept mutually mergeable. Ready for review.

jgruberf5 pushed a commit that referenced this pull request Sep 8, 2026
…core

Self-review findings on feat/v4-multi-cloud-ux-enhancements (tractable
minors + a real coverage gap; no blockers).

MINOR 1 — llm_observability_service.stats fleet branch: per-cluster
`models` is already a COUNT of distinct models, so max() silently
understated the fleet whenever clusters ran disjoint model sets. Switch
to sum() as an upper bound of "models in use across the fleet" (matching
the generic "Models" stat-tile), with a comment stating the true union
is not computable from these inputs. Pin the semantics with a fleet
`stats` test (previously untested).

Coverage gap — routes/k8s/search._scan_cluster_for_query (the ~260-line
live-scan core) was FULLY MOCKED in both integration tests. Add unit
tests that mock the k8s client RESPONSES (not the scan function) and
exercise Ingress/HTTPRoute/VirtualServer/Egress/Gateway/Service parsing,
LB-IP harvesting, CRD-absent tolerance, and the ThreadPoolExecutor
timeout harvest (partial results, no hang) + cross-cluster dedup. Add a
request-based negative-authZ test asserting the route requires
require_viewer (was only asserted by inspection).

Did NOT touch credentials_service.py (reconciled with #208 at merge).

Claude-Session: https://claude.ai/code/session_01UCsZXDxBsWV2s4kT47DwDW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants