load_kube_config fails when decode a not safe url token
What happened (please include outputs or screenshots): load_kube_config fails when decode a not safe url token
config.load_kube_config()
File "/Users/user/Library/Caches/pypoetry/virtualenvs/dev-helpers-ydB7Fkd--py3.10/lib/python3.10/site-packages/kubernetes/config/kube_config.py", line 820, in load_kube_config
loader.load_and_set(config)
File "/Users/user/Library/Caches/pypoetry/virtualenvs/dev-helpers-ydB7Fkd--py3.10/lib/python3.10/site-packages/kubernetes/config/kube_config.py", line 590, in load_and_set
self._load_authentication()
File "/Users/user/Library/Caches/pypoetry/virtualenvs/dev-helpers-ydB7Fkd--py3.10/lib/python3.10/site-packages/kubernetes/config/kube_config.py", line 288, in _load_authentication
if self._load_auth_provider_token():
File "/Users/user/Library/Caches/pypoetry/virtualenvs/dev-helpers-ydB7Fkd--py3.10/lib/python3.10/site-packages/kubernetes/config/kube_config.py", line 307, in _load_auth_provider_token
return self._load_oid_token(provider)
File "/Users/user/Library/Caches/pypoetry/virtualenvs/dev-helpers-ydB7Fkd--py3.10/lib/python3.10/site-packages/kubernetes/config/kube_config.py", line 399, in _load_oid_token
base64.b64decode(parts[1] + padding).decode('utf-8')
File "/usr/local/Cellar/[email protected]/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (1509) cannot be 1 more than a multiple of 4
What you expected to happen: load correctly the token
How to reproduce it (as minimally and precisely as possible): change your ~/.kube/config id-token to
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjB1b3pGdlFxZEJEaFNXSWNGYXFDQyJ9.eyJodXRoYW1lIjoicm5lY2siLCJuYW1lIjoicm5lY2siLCJwaWN0dXJlIjoiaHR0cHM6Ly9zLmdyYXZhdGFyLmNvbS9hdmF0YXIvZWI0MWUwMDQwNDI0NjZlODhhYzQ5MTY5MjQwZWE2N2U_cz00ODAmcj1wZyZkPWh0dHBzJTNBJTJGJTJGY2RuLmF1dGgwLmNvbSUyRmF2YXRhcnMlMkZ3dy5wbmciLCJ1cGRhdGVkX2F0IjoiMjAyMi0xMC0wNlQxMjo1NTo0NC43NjhaIiwiZW1haWwiOiJ3ZXVja0BpbnZvbSIsImlzcyI6Imh0dHBzOi8vaXRhZS1kZXYuYXV0LyIsInN1YiI6InNhbWxwfEluYS1EZXZ8Y2tAZS5jb20iLCJhdWQiOiJHTjQ1UDlzc2tpbzRXTHZTckF6NktQVHM4YWpNRGtrbSIsImlhdCI6MTY2NTA2MzcwMiwiZXhwIjoxNjUwMTAyfQ.p8yypFnPXEr1qbMikqGYWOKwZnUJ-jIQRCiSH24hwuL_SuvaMQ4lntlqMkOxOs7rUkyiDJmPpzM-t7qpMdwquWP08FslgOwNkbRpip43vEenJDsdOePHu9PsJ-mP6SNg6obj_v8o7u5vgp44C2Ov5O-ml06prBcmejCKduvDt3veb_ACgZ6L-w1xigHzfD6nJ5c2CHByXHG1Kkri_Gks2YUVJX8eAOnbZhjeQ9fiwHMJ2sKbP_nJJe1B6VqNTmqFgToKv7BeO2UVcgf-1kJF_-RClfD6ciOf0dFsGvoPgqXiLHfR2zVggTwSZFvT0L3vYTbWkBpTdFzLMJyzcCYNqQ
on python repr
from kubernetes import config
config.load_kube_config()
Anything else we need to know?:
changing this line to
base64.urlsafe_b64decode(parts[1] + padding).decode('utf-8')
solves the issue
Environment:
- Kubernetes version v1.25.0
- OS MacOS 12.12
- Python version 3.10.6
- Python client version 23.3.0
So only base64.urlsafe_b64decode(parts[1] + padding).decode('utf-8') this had to be added sir
Exactly.
Sir can I make up the changes then
Sure.
/assign @ramvikrams Thank you!
thanks sir I will start working on it
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale - Mark this issue or PR as rotten with
/lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Reopen this issue with
/reopen - Mark this issue as fresh with
/remove-lifecycle rotten - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou can:
- Reopen this issue with
/reopen- Mark this issue as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.