python icon indicating copy to clipboard operation
python copied to clipboard

`LocationParseError` on autogenerated kubectl from Juju

Open paulcjh opened this issue 2 years ago • 3 comments

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

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):
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

paulcjh avatar Mar 20 '23 19:03 paulcjh

I think currently this client doesn't support having square brackets around the IP/hostname

/kind feature-request /help

roycaihw avatar Mar 27 '23 16:03 roycaihw

@roycaihw: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

I think currently this client doesn't support having square brackets around the IP/hostname

/kind feature-request /help

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.

k8s-ci-robot avatar Mar 27 '23 16:03 k8s-ci-robot

@roycaihw: The label(s) kind/feature-request cannot be applied, because the repository doesn't have them.

In response to this:

I think currently this client doesn't support having square brackets around the IP/hostname

/kind feature-request /help

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.

k8s-ci-robot avatar Mar 27 '23 16:03 k8s-ci-robot