Skip to content

Added kubernetes.leaderelection in packages list to fix import error #1370

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

Merged
merged 1 commit into from
Feb 6, 2021

Conversation

soumitrak
Copy link
Contributor

Added kubernetes.leaderelection in packages list to fix No module named 'kubernetes.leaderelection' error

To reproduce: Make sure to create a file outside of checked out python repo directory.
$ cat hello_k8s.py
import kubernetes

kubernetes.config.load_kube_config()

k8s = kubernetes.client.CoreV1Api()
print("Listing pods with their IPs:")
ret = k8s.list_pod_for_all_namespaces(watch=False)
for i in ret.items:
print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))

python hello_k8s.py
Traceback (most recent call last):
File "hello_k8s.py", line 1, in
import kubernetes
File "", line 259, in load_module
File "anaconda3/lib/python3.8/site-packages/kubernetes-17.0.0_snapshot-py3.8.egg/kubernetes/init.py", line 25, in
ModuleNotFoundError: No module named 'kubernetes.leaderelection'

…ed 'kubernetes.leaderelection' error

To reproduce: Make sure to create a file outside of checked out python repo directory.
$ cat hello_k8s.py
import kubernetes

kubernetes.config.load_kube_config()

k8s = kubernetes.client.CoreV1Api()
print("Listing pods with their IPs:")
ret = k8s.list_pod_for_all_namespaces(watch=False)
for i in ret.items:
    print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))

python hello_k8s.py
Traceback (most recent call last):
  File "hello_k8s.py", line 1, in <module>
    import kubernetes
  File "<frozen zipimport>", line 259, in load_module
  File "anaconda3/lib/python3.8/site-packages/kubernetes-17.0.0_snapshot-py3.8.egg/kubernetes/__init__.py", line 25, in <module>
ModuleNotFoundError: No module named 'kubernetes.leaderelection'
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 5, 2021
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 5, 2021
@yliaog
Copy link
Contributor

yliaog commented Feb 5, 2021

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 5, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: soumitrak, yliaog

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2021
@soumitrak
Copy link
Contributor Author

test_portforward_raw failed, it is not related to this change. How can I rerun the tests to see if it succeeds in next run?

@yliaog
Copy link
Contributor

yliaog commented Feb 6, 2021

close and reopen this pr to trigger another ci run

@yliaog
Copy link
Contributor

yliaog commented Feb 6, 2021

/close

@k8s-ci-robot
Copy link
Contributor

@yliaog: Closed this PR.

In response to this:

/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.

@yliaog
Copy link
Contributor

yliaog commented Feb 6, 2021

/reopen

@k8s-ci-robot
Copy link
Contributor

@yliaog: Reopened this PR.

In response to this:

/reopen

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 k8s-ci-robot reopened this Feb 6, 2021
@soumitrak
Copy link
Contributor Author

close and reopen this pr to trigger another ci run

Thanks!

@k8s-ci-robot k8s-ci-robot merged commit 529bae3 into kubernetes-client:master Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants