Uh oh!
There was an error while loading. Please reload this page.
Fix GKE provider 401 on kubernetes client 36.x - #69032
Conversation
kubernetes-client 36.x renamed the bearer-token auth key from 'authorization' to 'BearerToken'. The GKE connection hand-builds a Configuration and registered the token/prefix only under 'authorization', so on 36.x the 'Bearer' prefix is dropped and requests go out with the raw token, which the cluster rejects with 401. Register the token and prefix under both keys so authentication works on client 35.x and 36.x alike, which lets the provider support 36.x without downgrading the kubernetes client (and reintroducing the NO_PROXY issue 36.x fixed).
shahar1
commented
Jun 26, 2026
CC: @molcay@VladaZakharova@MaksYermak |
Uh oh!
There was an error while loading. Please reload this page.
MaksYermak
left a comment
There was a problem hiding this comment.
@shahar1 what about backward compatibility with the previous version of cncf-provider before 18.0.0? Have you tested it with old one?
cncf.kubernetes (10.18.1) and apache.spark (6.2.0) were excluded from the 2026-06-16 wave after binding -1 votes; their blockers are now resolved, so re-cut the same versions with the fixes folded in. fab and keycloak need corrective patch releases (3.7.1, 0.8.1) after the airflowctl CLI client integration was reverted from core (apache#68856) and a Keycloak access-denied bug fix (apache#68951). celery (3.21.0) adds a Python 3.14 worker start-method config (apache#69015), and google (22.2.1) ships the GKE 401 fix for kubernetes client 36.x (apache#69032).
shahar1
commented
Jun 26, 2026
It should be fine - cncf-kubernetes before v10.18.0 (and after v10.12.2) uses kubernetes client v35.x, which reads the authorization key that this PR leaves untouched (it only adds BearerToken alongside), so the old path is unchanged and the extra key is just ignored. |
cncf.kubernetes (10.18.1) and apache.spark (6.2.0) were excluded from the 2026-06-16 wave after binding -1 votes; their blockers are now resolved, so re-cut the same versions with the fixes folded in. fab and keycloak need corrective patch releases (3.7.1, 0.8.1) after the airflowctl CLI client integration was reverted from core (apache#68856) and a Keycloak access-denied bug fix (apache#68951). celery (3.21.0) adds a Python 3.14 worker start-method config (apache#69015), and google (22.2.1) ships the GKE 401 fix for kubernetes client 36.x (apache#69032).
cncf.kubernetes (10.18.1) and apache.spark (6.2.0) were excluded from the 2026-06-16 wave after binding -1 votes; their blockers are now resolved, so re-cut the same versions with the fixes folded in. fab and keycloak need corrective patch releases (3.7.1, 0.8.1) after the airflowctl CLI client integration was reverted from core (#68856) and a Keycloak access-denied bug fix (#68951). celery (3.21.0) adds a Python 3.14 worker start-method config (#69015), and google (22.2.1) ships the GKE 401 fix for kubernetes client 36.x (#69032).
kubernetes-client 36.x renamed the bearer-token auth key from 'authorization' to 'BearerToken'. The GKE connection hand-builds a Configuration and registered the token/prefix only under 'authorization', so on 36.x the 'Bearer' prefix is dropped and requests go out with the raw token, which the cluster rejects with 401. Register the token and prefix under both keys so authentication works on client 35.x and 36.x alike, which lets the provider support 36.x without downgrading the kubernetes client (and reintroducing the NO_PROXY issue 36.x fixed).
cncf.kubernetes (10.18.1) and apache.spark (6.2.0) were excluded from the 2026-06-16 wave after binding -1 votes; their blockers are now resolved, so re-cut the same versions with the fixes folded in. fab and keycloak need corrective patch releases (3.7.1, 0.8.1) after the airflowctl CLI client integration was reverted from core (apache#68856) and a Keycloak access-denied bug fix (apache#68951). celery (3.21.0) adds a Python 3.14 worker start-method config (apache#69015), and google (22.2.1) ships the GKE 401 fix for kubernetes client 36.x (apache#69032).
related: #69023
Human Summary
Kubernetes client 36.x renamed the bearer auth key, which breaks GKE integration.
This PR fixes this behavior by providing both keys for compatibility.
AI Summary
Click here
Addresses the GKE 401 regression reported on the cncf.kubernetes 2026-06-16 RC by fixing the **google provider** rather than capping the kubernetes client to `<36` (which would reintroduce the NO_PROXY issue that 36.x fixed).Problem
kubernetes-client 36.x renamed the bearer-token auth key from
authorizationtoBearerToken(kubernetes-client/python#2582).GKEClusterConnectionhand-builds aConfigurationand registered the token/prefix only underauthorization. On 36.x,auth_settings()resolves the bearer value viaget_api_key_with_prefix("BearerToken", alias="authorization"): the token is found through theauthorizationalias, but the prefix is looked up by the primary identifierBearerToken(absent), so theBearerprefix is dropped. Requests then go out asAuthorization: <raw token>and the cluster rejects them with 401. (36.0.1 fixed this only forload_incluster_config/load_kube_config, not hand-built configs.)Fix
Register the bearer token and prefix under both
authorization(client 35.x) andBearerToken(client 36.x), in_get_configand the token-refresh hook. Authentication now works on both client lines, so the provider supports 36.x without a downgrade. The refresh-on-expiry behavior is preserved.Test
TestGKEClusterConnection.test_auth_settings_send_bearer_prefixed_tokenasserts the realauth_settings()["BearerToken"]["value"]isBearer <token>(both valid and expiring credentials). Verified it fails on the pre-fix code under client 36.0.2 and passes after.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.8) following the guidelines