Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_config does not really support "context" #2203

Open
addyess opened this issue Mar 1, 2024 · 1 comment · May be fixed by #2204
Open

load_config does not really support "context" #2203

addyess opened this issue Mar 1, 2024 · 1 comment · May be fixed by #2204
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@addyess
Copy link

addyess commented Mar 1, 2024

similar to #2038

What happened (please include outputs or screenshots):
passing context as an argument to load_config -- even if that argument is None does not work because load_incluster_config does not list it as an argument

What you expected to happen:
A context argument should be able to be passed into load_incluster_config and if it's value is non-None, then perhaps a ConfigException should be raised

How to reproduce it (as minimally and precisely as possible):

  • start a bare ubuntu lxd,
  • create a virtual environment
  • pip install kubernetes
  • pass an context=None, since there is no .kube/config it will try to load the incluster config and fail
(venv) ubuntu@focal:~$ python -c "import kubernetes.config; kubernetes.config.load_config(context=None)"
kube_config_path not provided and default location (~/.kube/config) does not exist. Using inCluster Config. This might not work.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ubuntu/venv/lib/python3.8/site-packages/kubernetes/config/__init__.py", line 49, in load_config
    load_incluster_config(**kwargs)
TypeError: load_incluster_config() got an unexpected keyword argument 'context'

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): N/A
  • OS (e.g., MacOS 10.13.6): N/A
  • Python version (python --version): py3.8.10 (but doesn't matter)
  • Python client version (pip list | grep kubernetes):
venv) ubuntu@focal:~$ pip list | grep kubernetes
kubernetes         29.0.0  
@addyess addyess added the kind/bug Categorizes issue or PR as related to a bug. label Mar 1, 2024
addyess added a commit to charmed-kubernetes/pytest-operator that referenced this issue Mar 1, 2024
@roycaihw
Copy link
Member

/assign @addyess
Thanks for sending the PR!

addyess added a commit to charmed-kubernetes/pytest-operator that referenced this issue Apr 29, 2024
* Produce apis to add a k8s cloud and tear down its models first
* Don't test if there's no k8s around, only wait for model to disappear when we're not keeping it
* Successfully tested with storage
* workaround issue kubernetes-client/python#2203
* Adjust linting for BundleOpt
* test with updated inclusivity workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants