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

timeout connecting to pulp on K8S #163

Closed
maciej-markowski opened this issue Jun 25, 2024 · 2 comments
Closed

timeout connecting to pulp on K8S #163

maciej-markowski opened this issue Jun 25, 2024 · 2 comments

Comments

@maciej-markowski
Copy link
Contributor

Hello,

I have deployed the pulp with use of the pulp operator on K8S cluster.
I have no problem connecting to the pulp and perform any CRUD operations with use of curl or pulp-cli, but when using squeezer, I am getting timeouts.

Traceback (most recent call last):
  File "/ansible/.ansible/tmp/ansible-tmp-1719302750.7030585-351-223232701389169/AnsiballZ_rpm_remote.py", line 107, in <module>
    _ansiballz_main()
  File "/ansible/.ansible/tmp/ansible-tmp-1719302750.7030585-351-223232701389169/AnsiballZ_rpm_remote.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/ansible/.ansible/tmp/ansible-tmp-1719302750.7030585-351-223232701389169/AnsiballZ_rpm_remote.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.pulp.squeezer.plugins.modules.rpm_remote', init_globals=dict(_module_fqn='ansible_collections.pulp.squeezer.plugins.modules.rpm_remote', _modlib_path=modlib_path),
  File "/usr/local/lib/python3.9/runpy.py", line 225, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_pulp.squeezer.rpm_remote_payload_sw7l1qdg/ansible_pulp.squeezer.rpm_remote_payload.zip/ansible_collections/pulp/squeezer/plugins/modules/rpm_remote.py", line 121, in <module>
  File "/tmp/ansible_pulp.squeezer.rpm_remote_payload_sw7l1qdg/ansible_pulp.squeezer.rpm_remote_payload.zip/ansible_collections/pulp/squeezer/plugins/modules/rpm_remote.py", line 84, in main
  File "/tmp/ansible_pulp.squeezer.rpm_remote_payload_sw7l1qdg/ansible_pulp.squeezer.rpm_remote_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/pulp.py", line 72, in __enter__
  File "/tmp/ansible_pulp.squeezer.rpm_remote_payload_sw7l1qdg/ansible_pulp.squeezer.rpm_remote_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/openapi.py", line 65, in __init__
  File "/tmp/ansible_pulp.squeezer.rpm_remote_payload_sw7l1qdg/ansible_pulp.squeezer.rpm_remote_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/openapi.py", line 84, in load_api
  File "/tmp/ansible_pulp.squeezer.rpm_remote_payload_sw7l1qdg/ansible_pulp.squeezer.rpm_remote_payload.zip/ansible_collections/pulp/squeezer/plugins/module_utils/openapi.py", line 107, in _download_api
  File "/tmp/ansible_pulp.squeezer.rpm_remote_payload_sw7l1qdg/ansible_pulp.squeezer.rpm_remote_payload.zip/ansible/module_utils/urls.py", line 1578, in open
  File "/usr/local/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/local/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.9/urllib/request.py", line 1375, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/local/lib/python3.9/urllib/request.py", line 1350, in do_open
    r = h.getresponse()
  File "/usr/local/lib/python3.9/http/client.py", line 1377, in getresponse
    response.begin()
  File "/usr/local/lib/python3.9/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.9/http/client.py", line 281, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

Strangely, status task is working fine.
The tasks I am using:

    - name: Get status & refresh api
      pulp.squeezer.status:
        pulp_url: "{{ pulp_api_url }}"
        validate_certs: false
        username: "{{ pulp_admin_user }}"
        password: "{{ pulp_admin_pass }}"
        refresh_api_cache: true

    - name: Create  RPM remote
      pulp.squeezer.rpm_remote:
        pulp_url: "{{ pulp_api_url }}"
        validate_certs: false
        username: "{{ pulp_admin_user }}"
        password: "{{ pulp_admin_pass }}"
        name: "remote-{{ item.name }}"
        url: "{{ item.url }}"
        policy: "immediate"
        tls_validation: "{{ pulp_content_validate_certs }}"
        proxy_url: "{{ proxy_env.https_proxy | default(omit) }}"
        state: present
      loop: "{{ pulp_rpm_repos }}"

For testing purposes, I edited /usr/local/lib/python3.9/urllib/request.py and hardcoded timeout value of 30 seconds and the issue was gone.

ansible version:

ansible --version
ansible [core 2.15.12]
  config file = /ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /ansible/.ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.19 (main, Jun 13 2024, 07:03:54) [GCC 12.2.0] (/usr/local/bin/python)
  jinja version = 3.1.4
  libyaml = True

squeezer version:

ansible-galaxy collection list | grep squeezer
pulp.squeezer                 0.0.15 

It looks similar to https://discourse.pulpproject.org/t/sync-error-with-ansible-squeezer-module/1229

Is it possible to add pulp_timeout parameter to all squeezer modules?

@maciej-markowski
Copy link
Contributor Author

I am glad we were able to merge #164
@mdellweg what are the plans for releasing it?

@mdellweg
Copy link
Member

mdellweg commented Jul 5, 2024

@mdellweg mdellweg closed this as completed Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants