Skip to content
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

playbook in error when using openshift lib 0.12 #12

Open
nergalex opened this issue Mar 24, 2021 · 7 comments
Open

playbook in error when using openshift lib 0.12 #12

nergalex opened this issue Mar 24, 2021 · 7 comments
Labels
needs_verify type/bug Something isn't working

Comments

@nergalex
Copy link

SUMMARY

Error encounter when using openshift 0.12 package and community.kubernetes.k8s. See attached file: error_with_openshift_0.12.json.txt
community.kubernetes.k8s works well with openshift 0.11.2 pakage. See attached file: ok_with_openshift_0.11.2.json.txt
error_with_openshift_0.12.json.txt
ok_with_openshift_0.11.2.json.txt

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.kubernetes.k8s

ANSIBLE VERSION

Virtual Env with openshift 0.11.2 and 0.12.0 run both:

ansible 2.9.18
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/custom-envs/cloudbuilder-collection2/lib/python2.7/site-packages/ansible
  executable location = /opt/custom-envs/cloudbuilder-collection2/bin/ansible
  python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
# ansible-config dump --only-changed
/opt/custom-envs/cloudbuilder-collection2/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.exceptions import InvalidSignature

OS / ENVIRONMENT
# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.9 (Maipo)
STEPS TO REPRODUCE

https://github.com/nergalex/f5-aks-nginx_ingress_app_protect/blob/master/playbooks/roles/poc-k8s/tasks/create_nap_log_format.yaml

EXPECTED RESULTS

See attached file: ok_with_openshift_0.11.2.json.txt

ACTUAL RESULTS

See attached file: ok_with_openshift_0.11.2.json.txt

@tima
Copy link
Collaborator

tima commented Mar 24, 2021

@nergalex What version of this collection are you using? Is it the latest stable, v1.2?

@nergalex
Copy link
Author

Sorry, please find attached error ouput with community.kubernetes version: 1.2.0 (and not 1.1.1 in the previous message)

"msg": "Failed to load kubeconfig due to Invalid kube-config file. No configuration found."

error_with_openshift_0.12_and_collection_1.2.0.json.txt

@gravesm
Copy link
Member

gravesm commented Mar 29, 2021

@nergalex I am unable to reproduce this. Specifying the path to the kubeconfig file works for me.

@belenot
Copy link

belenot commented Apr 4, 2021

I have this issue too.
It's solved when I patched common.py in /usr/local/lib/python3.8/dist-packages/ansible_collections/community/kubernetes/plugins/module_utils/common.py on line 263.

            #return DynamicClient(kubernetes.client.ApiClient(configuration))
            return DynamicClient(kubernetes.config.new_client_from_config())

I don't know how to watch version, and have not time for this anymore.
I can give more info, if needed and if someone tell me how to obtain it )

@nergalex
Copy link
Author

nergalex commented Apr 6, 2021

thx @belenot . I would not prefer to modify kubernetes ansible collection because it's loaded for each job by Tower (collections/requirements.yml is used).

@gravesm
using a config.yaml file located in a AWX project, the module invocation differs:

  • kubernetes collection 1.2.0 : invocation.module_args.kubeconfig: "config.yaml" --> error_with_openshift_0.12_and_collection_1.2.0.json.txt line 12
  • kubernetes collection 1.1.1 : invocation.module_args.kubeconfig: "/tmp/bwrap_24858_brzydgui/awx_24858_bs7aho2c/project/playbooks/roles/poc-k8s/files/config.yaml" --> ok_with_openshift_0.11.2.json.txt line 63

Did you reproduced this behavior?

@gravesm gravesm transferred this issue from ansible-collections/community.kubernetes Apr 8, 2021
@goneri goneri added type/bug Something isn't working needs_verify labels Apr 9, 2021
@belenot
Copy link

belenot commented Apr 13, 2021

thx @belenot . I would not prefer to modify kubernetes ansible collection because it's loaded for each job by Tower (collections/requirements.yml is used).

I know @nergalex , that's why I just specified previous version of package for pip3 installation on remote host, namely openshift==0.11.0. This fixed my issue.

@nergalex
Copy link
Author

thx @belenot, same workaround :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_verify type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants