Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

kube_config.py is unable to merge configs when one of configs has removed all contexts #183

Closed
matihost opened this issue Feb 19, 2020 · 7 comments
Assignees
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@matihost
Copy link

  File \"/home/myuser/.local/lib/python3.6/site-packages/kubernetes/config/kube_config.py\", line 664, in load_kube_config
    persist_config=persist_config)
  File \"/home/myuser/.local/lib/python3.6/site-packages/kubernetes/config/kube_config.py\", line 620, in _get_kube_config_loader_for_yaml_file
    kcfg = KubeConfigMerger(filename)
  File \"/home/myuser/.local/lib/python3.6/site-packages/kubernetes/config/kube_config.py\", line 574, in __init__
    self.load_config(path)
  File \"/home/myuser/.local/lib/python3.6/site-packages/kubernetes/config/kube_config.py\", line 592, in load_config
    self._merge(item, config.get(item, {}), path)
  File \"/home/myuser/.local/lib/python3.6/site-packages/kubernetes/config/kube_config.py\", line 597, in _merge
    for new_item in add_cfg:
TypeError: 'NoneType' object is not iterable

when:

KUBECONFIG=/home/myuser/.kube/config:/home/myuser/.kube/microk8s.config

and for example one of them defines null contexts:

contexts: null

It happens when

kubectl config delete-context microk8s 

is invoked and there is no context left in kube config file.

Fix proposal add if:

    def _merge(self, item, add_cfg, path):
        if add_cfg is not None:
          for new_item in add_cfg:

around

for new_item in add_cfg:

@roycaihw
Copy link
Member

roycaihw commented Mar 2, 2020

/assign @palnabarun

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 31, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 30, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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.

@weininghu1012
Copy link

Hi, I also encounter this issue with error like:

  File "/Users/weininghu/.pyenv/virtualenvs/kafka-topic-manager/3.7.8/lib/python3.7/site-packages/kubernetes/config/kube_config.py", line 672, in _merge
    for new_item in add_cfg:
TypeError: 'NoneType' object is not iterable

Is this issue being working on?

@mohammedi-haroune
Copy link

I'm also getting this error

    def _merge(self, item, add_cfg, path):
>       for new_item in add_cfg:
E       TypeError: 'NoneType' object is not iterable

../../venv/lib/python3.7/site-packages/kubernetes/config/kube_config.py:672: TypeError

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

7 participants