kubernetes-client / kubernetes-client/python
`LocationParseError` on autogenerated kubectl from Juju
- Dominant language
- Python
- Stars
- 7.7k
- Forks
- 3.5k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 18
Description
**What happened (please include outputs or screenshots)**:
Juju generates kubectl configs for users when adding them to a Juju controller and supports multiple main controllers resulting in an array output in the hostname. When running `config.load_kube_config()` a `urllib3.exceptions.LocationParseError` is returned as it cannot parse the array correctly.
The configuration file works perfectly well with kubectl.
**What you expected to happen**:
One of the following:
1. A standard failover attempt system when connecting
2. All IPs validated, random one used
3. All IPs validated, first one used
**How to reproduce it (as minimally and precisely as possible)**:
Add square brackets around the IP/hostname in your kubectl config file as shown below
```python
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: ...
server: https://[10.1.x.x, 10.1.x.y]:443
name: juju-cluster
```
**Environment**:
- Kubernetes version (`kubectl version`):
```bash
Client Version: v1.26.3
Kustomize Version: v4.5.7
Server Version: v1.25.8
```
- OS (e.g., MacOS 10.13.6):
Ubuntu 20.04
- Python version (`python --version`)
`3.9.13`
- Python client version (`pip list | grep kubernetes`)
26.1.0
Contributor guide
Research direction
Start at config.load_kube_config() and reproduce the LocationParseError with the Juju-style server value shown in the issue. Trace how the bracketed hostname is passed to the connection layer, then define and verify the selected handling for multiple IPs against the kubectl-compatible configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100