Commit 322667b
committed
config: write api_key['BearerToken'] so v36+ SDK auth works
v36 rewrote Configuration.auth_settings() to look up the bearer-token
credential under api_key['BearerToken'], matching the OpenAPI security
scheme name. The in-cluster and kubeconfig loaders were not updated -
they still write api_key['authorization'], the v35 lookup key.
As a result, on v36 every call to load_incluster_config() (and
load_kube_config() with a static token) produces a Configuration whose
auth_settings() yields no bearer credential, so outgoing API requests
are sent without an Authorization header and the apiserver treats them
as system:anonymous.
Write the token under both 'authorization' (v35) and 'BearerToken'
(v36+) so requests carry the expected header on either SDK release line.
Add a regression test in incluster_config_test that drives a real
ApiClient.update_params_for_auth() against a freshly-loaded
Configuration and asserts the resulting headers contain an Authorization
entry - the end-to-end invariant that v36 quietly broke.1 parent 26761f3 commit 322667b
4 files changed
Lines changed: 28 additions & 4 deletions
File tree
- kubernetes/base/config
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
111 | 128 | | |
112 | 129 | | |
113 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
| 531 | + | |
531 | 532 | | |
532 | 533 | | |
533 | 534 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| 373 | + | |
373 | 374 | | |
374 | 375 | | |
375 | 376 | | |
| |||
1317 | 1318 | | |
1318 | 1319 | | |
1319 | 1320 | | |
1320 | | - | |
| 1321 | + | |
| 1322 | + | |
1321 | 1323 | | |
1322 | 1324 | | |
1323 | 1325 | | |
| |||
1395 | 1397 | | |
1396 | 1398 | | |
1397 | 1399 | | |
1398 | | - | |
| 1400 | + | |
| 1401 | + | |
1399 | 1402 | | |
1400 | 1403 | | |
1401 | 1404 | | |
| |||
1408 | 1411 | | |
1409 | 1412 | | |
1410 | 1413 | | |
1411 | | - | |
| 1414 | + | |
| 1415 | + | |
1412 | 1416 | | |
1413 | 1417 | | |
1414 | 1418 | | |
| |||
1422 | 1426 | | |
1423 | 1427 | | |
1424 | 1428 | | |
1425 | | - | |
| 1429 | + | |
| 1430 | + | |
1426 | 1431 | | |
1427 | 1432 | | |
1428 | 1433 | | |
| |||
0 commit comments