Skip to content

Commit 8ac9a45

Browse files
authored
Merge branch 'stackhpc/2023.1' into opensearch-dashboards-blackbox-fix
2 parents d78fe65 + 56e4175 commit 8ac9a45

File tree

5 files changed

+39
-2
lines changed

5 files changed

+39
-2
lines changed

doc/source/contributor/environments/ci-builder.rst

+7
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ Pulp proxy that injects an HTTP basic auth header into requests that it
151151
proxies. Because this proxy bypasses Pulp's authentication, it must not be
152152
exposed to any untrusted environment.
153153

154+
Ensure that ``localhost`` is resolvable if Docker bridge networking is
155+
disabled. This may be achieved by adding the following to ``/etc/hosts``:
156+
157+
.. parsed-literal::
158+
159+
127.0.0.1 localhost
160+
154161
To deploy the proxy:
155162

156163
.. parsed-literal::

etc/kayobe/ansible/pulp-auth-proxy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- import_role:
99
name: pulp_auth_proxy
1010
vars:
11-
pulp_auth_proxy_url: "{{ stackhpc_repo_mirror_url }}"
11+
pulp_auth_proxy_url: "{{ stackhpc_release_pulp_url }}"
1212
pulp_auth_proxy_username: "{{ stackhpc_repo_mirror_username }}"
1313
pulp_auth_proxy_password: "{{ stackhpc_repo_mirror_password }}"
1414
pulp_auth_proxy_conf_path: "{{ base_path }}/containers/pulp_proxy"

etc/kayobe/ansible/roles/pulp_auth_proxy/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ any untrusted environment.
1515

1616
## Role variables
1717

18-
* `pulp_auth_proxy_pulp_url`: URL of the Pulp server to proxy requests to.
18+
* `pulp_auth_proxy_url`: URL of the Pulp server to proxy requests to.
1919
* `pulp_auth_proxy_username`: Username of the Pulp server to proxy requests to.
2020
* `pulp_auth_proxy_password`: Password of the Pulp server to proxy requests to.
2121
* `pulp_auth_proxy_conf_path`: Path to a directory in which to write Nginx

etc/kayobe/ansible/roles/pulp_auth_proxy/defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ pulp_auth_proxy_password:
55
pulp_auth_proxy_conf_path:
66
pulp_auth_proxy_listen_ip: 127.0.0.1
77
pulp_auth_proxy_listen_port: 80
8+
pulp_auth_proxy_network_mode:

etc/kayobe/ansible/roles/pulp_auth_proxy/tasks/main.yml

+29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
---
2+
- when: pulp_auth_proxy_network_mode is none
3+
block:
4+
- name: Check if Docker bridge network exists
5+
community.docker.docker_host_info:
6+
networks: true
7+
register: docker_host_info
8+
9+
- name: Set a fact about the network mode
10+
ansible.builtin.set_fact:
11+
pulp_auth_proxy_network_mode: "{{ 'host' if docker_host_info.networks | selectattr('Driver', 'equalto', 'bridge') | list | length == 0 else 'bridge' }}"
12+
13+
- name: Assert that localhost is resolvable when using host networking
14+
assert:
15+
that:
16+
- "'localhost' is ansible.utils.resolvable"
17+
fail_msg: >-
18+
localhost must be resolvable when using Docker host networking with this container.
19+
Consider adding '127.0.0.1 localhost' to /etc/hosts.
20+
when: pulp_auth_proxy_network_mode == 'host'
21+
222
- name: "Ensure {{ pulp_auth_proxy_conf_path }} exists"
323
ansible.builtin.file:
424
path: "{{ pulp_auth_proxy_conf_path }}"
@@ -18,9 +38,18 @@
1838
community.docker.docker_container:
1939
name: pulp_proxy
2040
image: nginx:stable-alpine
41+
network_mode: "{{ pulp_auth_proxy_network_mode }}"
2142
ports:
2243
- "{{ pulp_auth_proxy_listen_ip }}:{{ pulp_auth_proxy_listen_port }}:80"
2344
restart_policy: "no"
2445
restart: "{{ pulp_proxy_conf is changed }}"
2546
volumes:
2647
- "{{ pulp_auth_proxy_conf_path }}/pulp_proxy.conf:/etc/nginx/conf.d/default.conf:ro"
48+
49+
- name: Wait for pulp_proxy container to become accessible
50+
ansible.builtin.uri:
51+
url: http://localhost/pulp/api/v3/status/
52+
register: uri_result
53+
until: uri_result is success
54+
retries: 30
55+
delay: 2

0 commit comments

Comments
 (0)