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

_load_user_token base_path = self._get_base_path(self._user.path) AttributeError: 'str' object has no attribute 'path' #182

Description

@max-allan-surevine
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 03:03:55) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from kubernetes import config
>>> config.load_kube_config('/tmp/kubeconfig')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kubernetes/config/kube_config.py", line 649, in load_kube_config
    loader.load_and_set(config)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kubernetes/config/kube_config.py", line 461, in load_and_set
    self._load_authentication()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kubernetes/config/kube_config.py", line 205, in _load_authentication
    if self._load_user_token():
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kubernetes/config/kube_config.py", line 395, in _load_user_token
    base_path = self._get_base_path(self._user.path)
AttributeError: 'str' object has no attribute 'path'

Kubeconfig :

Kind: config
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0...Qo=
    server: https://0...C.sk1.eu-west-2.eks.amazonaws.com
  name: k8s
contexts:
- context:
    cluster: k8s
    user: aws
  name: aws
current-context: aws
users:
- name: aws
  user: lambda

This used to work with previous versions.
Other people have the same issue, "resolved" by pinning to version 9 of kubernetes.
aws-samples/amazon-k8s-node-drainer#14

Activity

  1. roycaihw commented on Mar 2, 2020

    @roycaihw
    Member

    /assign

  2. roycaihw commented on Mar 3, 2020

    @roycaihw
    Member

    This is a regression introduced in #94.

    Technically a user with a string value (user: lambda) doesn't provide any auth info, and when we _load_authentication it should be a noop. _get_base_path expects path from _user because in most cases _user would be a dict or list, which gets converted to a ConfigNode.

    A workaround is to change your kubeconfig to make user a dict or a list, instead of a string. E.g.

    users:
    - name: aws
      user:
        name: lambda
    

    We should fix the behavior in this client and add a test. I can think of either constructing a ConfigNode around the string value, or skipping _load_user_token when _user doesn't have those token keys. I need to think which way makes more sense.

  3. fejta-bot commented on Jun 1, 2020

    @fejta-bot

    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

  4. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Jun 1, 2020
  5. fejta-bot commented on Jul 1, 2020

    @fejta-bot

    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

  6. added
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Jul 1, 2020
  7. max-allan-surevine commented on Jul 3, 2020

    @max-allan-surevine
    Author

    /remove-lifecycle rotten

  8. removed
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    on Jul 3, 2020
  9. fejta-bot commented on Oct 1, 2020

    @fejta-bot

    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

  10. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Oct 1, 2020
  11. fejta-bot commented on Oct 31, 2020

    @fejta-bot

    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

  12. added
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Oct 31, 2020
  13. fejta-bot commented on Nov 30, 2020

    @fejta-bot

    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

  14. k8s-ci-robot commented on Nov 30, 2020

    @k8s-ci-robot
    Contributor

    @fejta-bot: Closing this issue.

    Details

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions