Skip to content

Cap kubernetes client to <36 to fix cluster auth 401 regression#69025

Closed
shahar1 wants to merge 1 commit into
apache:mainfrom
shahar1:cap-kubernetes-client-below-36
Closed

Cap kubernetes client to <36 to fix cluster auth 401 regression#69025
shahar1 wants to merge 1 commit into
apache:mainfrom
shahar1:cap-kubernetes-client-below-36

Conversation

@shahar1

@shahar1 shahar1 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

apache-airflow-providers-cncf-kubernetes 10.18.0 widened the kubernetes client bound to allow 36.x (#68041). Client 36.x renamed the bearer-token auth key from authorization to BearerToken (kubernetes-client/python#2582), which breaks authentication for code that hand-builds a Configuration.

The google (GKE) sync hook sets api_key={"authorization": token} / api_key_prefix={"authorization": "Bearer"}. On 36.x, get_api_key_with_prefix("BearerToken", alias="authorization") finds the token via the authorization alias but looks up the prefix by the primary identifier BearerToken (absent), so the Bearer prefix is dropped and the request goes out as Authorization: <raw token>401 Unauthorized (immediate, not token-rotation related). This was caught while testing the google (GKE) provider; downgrading the provider to 10.17.1 (client 35.x) is the reported workaround.

36.0.1 (kubernetes-client/python#2585) fixed this only for load_incluster_config() / load_kube_config() (which cncf's own hooks use), not for hand-built configs — so the google GKE sync path still breaks on 36.0.1/36.0.2. It is the same 36.x Configuration change behind the in-cluster pickling crash (#68827).

35.x is the last known-good line, so this restores the previous <36 cap for both kubernetes and kubernetes_asyncio until the provider auth paths support 36.x. Full 36.x support (google GKE sync hook fix + a regression test asserting Authorization: Bearer <token>) is tracked in #69023, linked from the cap site in pyproject.toml.

related: #69023
related: #68827


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 4.8)

Generated-by: Claude Code (Opus 4.8) following the guidelines

Client 36.x renamed the bearer-token auth key from 'authorization' to
'BearerToken' (kubernetes-client/python#2582). Provider code that hand-builds
a Configuration with api_key={'authorization': ...} -- the google (GKE) sync
hook -- then loses the "Bearer " prefix and sends the raw token, so the
cluster rejects requests with 401. 36.0.1 fixed only the in-cluster and
kube_config loaders, not that path. 35.x is the last known-good line, so
restore the previous cap until the provider auth paths are fixed and
validated on 36.x.
@vatsrahul1001

vatsrahul1001 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@shahar1 Kubernetes and kubernetes_asyncio was upgraded to 36.0 to fix no_proxy issue introduced by kubernetes client 35. I am afraid limitting <36 will again introduced same issue. So I think better way should be to support this in gke provider instead of downgrading kubernetes client

@shahar1 shahar1 closed this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants