python icon indicating copy to clipboard operation
python copied to clipboard

`load_config` does not really support "context"

Open addyess opened this issue 1 year ago • 2 comments

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 avatar Mar 01 '24 14:03 addyess

/assign @addyess Thanks for sending the PR!

roycaihw avatar Mar 13 '24 20:03 roycaihw

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jun 11 '24 20:06 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Jul 11 '24 21:07 k8s-triage-robot

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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 avatar Aug 10 '24 21:08 k8s-triage-robot

@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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

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-sigs/prow repository.

k8s-ci-robot avatar Aug 10 '24 21:08 k8s-ci-robot