-
Notifications
You must be signed in to change notification settings - Fork 140
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
common: k8s module import fails due to upstream Ansible bug #162
Comments
@amin224 Thanks for reporting this issue. Could you please update Ansible to 2.9.17 or latest and retry? |
@Akasurde Please check below results as you requested. Unfortunately I am getting the same error when running the playbook.
|
ansible/ansible#68361 (comment) My issue is similar to this output, and they are suggesting to upgrade to 2.10 I will try and share results.
|
The issue you connected is not working. Could you please correct the link? |
Apologies. Fixed |
@amin224 Is it possible for you to upgrade to 2.10 or the latest? |
Yes I will install ansible 2.10 and share results hopefully it works. |
I am trying to reproduce this issue on 2.9 with the Kubernetes collection. |
To workaround Ansible upstream bug, import k8sdynamicclient directly. Fixes: ansible-collections#162 Signed-off-by: Abhijeet Kasurde <[email protected]>
@Akasurde Good day, I tested both versions of ansible 2.9.6 and ansible 2.10.11 in 2 different VMs In ansible version 2.9.6 I edited the lines of code in the path
After running the ansible-playbook
In ansible version 2.10.11, without changing the common.py file I received the following error as well. I will try to troubleshoot the problem and share results.
|
@amin224 Please copy exactly as per the following - diff --git a/plugins/module_utils/common.py b/plugins/module_utils/common.py
index 48e55ec..844d20a 100644
--- a/plugins/module_utils/common.py
+++ b/plugins/module_utils/common.py
@@ -53,7 +53,7 @@ except ImportError as e:
IMP_K8S_CLIENT = None
try:
- from ansible_collections.kubernetes.core.plugins.module_utils.k8sdynamicclient import K8SDynamicClient
+ from ansible_collections.kubernetes.core.plugins.module_utils import k8sdynamicclient
from ansible_collections.kubernetes.core.plugins.module_utils.client.discovery import Lazy
Discoverer
IMP_K8S_CLIENT = True
except ImportError as e:
@@ -195,7 +195,7 @@ def get_api_client(module=None, **kwargs):
return client
try:
- client = K8SDynamicClient(kubernetes.client.ApiClient(configuration), discoverer=LazyD
iscoverer)
+ client = k8sdynamicclient.K8SDynamicClient(kubernetes.client.ApiClient(configuration),
discoverer=LazyDiscoverer) and install
or use the package manager to install it. |
@Akasurde Thank you for your time and much appreciated help!
There are no errors when deploying Kubernetes resources using ansible playbooks. Please note that this issue is related to 2.9.x versions of ansible, but in version 2.10.11 I did not have to edit the common.py file. |
@amin224 Sweet. Thanks for the feedback. |
ISSUE TYPE
COMPONENT NAME
ENVIRONMENT
Operating System: Ubuntu 20.04
ansible-galaxy collection install kubernetes.core
SUMMARY
I am testing the Kubernetes module by creating a simple namespace resource but I am getting this Error and I cannot find a similar topic elsewhere.
The text was updated successfully, but these errors were encountered: