Skip to content

Commit 2a0994f

Browse files
committed
Merge stackhpc/zed into stackhpc/2023.1
2 parents 422267a + 49ed53c commit 2a0994f

21 files changed

+192
-44
lines changed

.github/path-filters.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ aio:
2020
- 'kayobe-env'
2121
- 'requirements.txt'
2222
- 'terraform/aio/**'
23+
check-tags:
24+
- '.github/workflows/stackhpc-check-tags.yml'
25+
- 'etc/kayobe/kolla-image-tags.yml'

.github/workflows/stackhpc-all-in-one.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ jobs:
107107
fi
108108
echo kayobe_image=$kayobe_image >> $GITHUB_OUTPUT
109109
110-
- name: Make sure dockerd is running and test Docker.
110+
- name: Make sure dockerd is running and test Docker
111111
run: |
112-
docker run --rm hello-world
112+
docker ps
113113
114114
- name: Output image tag
115115
id: image_tag

.github/workflows/stackhpc-build-kayobe-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
# Setting KAYOBE_USER_UID and KAYOBE_USER_GID to 1001 to match docker's defaults
8686
# so that docker can run as a privileged user within the Kayobe image.
8787
- name: Build and push Docker image
88-
uses: docker/build-push-action@v4
88+
uses: docker/build-push-action@v5
8989
with:
9090
file: ./.automation/docker/kayobe/Dockerfile
9191
context: .

.github/workflows/stackhpc-check-tags.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
description: Kayobe container image
1111
type: string
1212
required: true
13+
if:
14+
description: Whether to run the workflow (workaround for required status checks issue)
15+
type: boolean
16+
default: true
1317
secrets:
1418
KAYOBE_VAULT_PASSWORD:
1519
required: true
@@ -19,7 +23,7 @@ env:
1923
jobs:
2024
check-tags:
2125
name: Check container image tags
22-
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
26+
if: inputs.if
2327
runs-on: arc-skc-aio-runner
2428
permissions: {}
2529
env:

.github/workflows/stackhpc-container-image-build.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116

117117
- name: Make sure dockerd is running and test Docker
118118
run: |
119-
docker run --rm hello-world
119+
docker ps
120120
121121
- name: Install Kayobe
122122
run: |
@@ -127,25 +127,37 @@ jobs:
127127
pip install -U pip &&
128128
pip install ../src/kayobe
129129
130-
# Required for Docker registry login. Normally installed during host configure.
130+
# Required for Pulp auth proxy deployment and Docker registry login.
131+
# Normally installed during host configure.
131132
- name: Install Docker Python SDK
132133
run: |
133-
pip install --user docker
134+
sudo pip install docker
134135
135136
- name: Configure localhost as a seed
136137
run: |
137-
cat > src/kayobe-config/etc/kayobe/environments/ci-builder/inventory/hosts << EOF
138138
# A 'seed' host used for building images.
139139
# Use localhost for container image builds.
140140
[seed]
141141
localhost ansible_connection=local ansible_python_interpreter=/usr/bin/python3
142142
EOF
143143
144+
# See etc/kayobe/ansible/roles/pulp_auth_proxy/README.md for details.
145+
# NOTE: We override pulp_auth_proxy_conf_path to a path shared by the
146+
# runner and dind containers.
147+
- name: Deploy an authenticating package repository mirror proxy
148+
run: |
149+
source venvs/kayobe/bin/activate &&
150+
source src/kayobe-config/kayobe-env --environment ci-builder &&
151+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/pulp-auth-proxy.yml -e pulp_auth_proxy_conf_path=/home/runner/_work/pulp_proxy
152+
env:
153+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
154+
144155
- name: Build and push kolla overcloud images
145156
run: |
146157
args="${{ github.event.inputs.regexes }}"
147158
args="$args -e kolla_base_distro=${{ matrix.distro }}"
148159
args="$args -e kolla_tag=$KOLLA_TAG"
160+
args="$args -e stackhpc_repo_mirror_auth_proxy_enabled=true"
149161
if ${{ inputs.push }} == 'true'; then
150162
args="$args --push"
151163
fi
@@ -161,6 +173,7 @@ jobs:
161173
run: |
162174
args="-e kolla_base_distro=${{ matrix.distro }}"
163175
args="$args -e kolla_tag=$KOLLA_TAG"
176+
args="$args -e stackhpc_repo_mirror_auth_proxy_enabled=true"
164177
if ${{ inputs.push }} == 'true'; then
165178
args="$args --push"
166179
fi

.github/workflows/stackhpc-pull-request.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
2121
outputs:
2222
aio: ${{ steps.changes.outputs.aio }}
23+
check-tags: ${{ steps.changes.outputs.check-tags }}
2324
steps:
2425
- name: GitHub Checkout
2526
uses: actions/checkout@v4
@@ -79,12 +80,14 @@ jobs:
7980
check-tags:
8081
name: Check container image tags
8182
needs:
83+
- check-changes
8284
- build-kayobe-image
8385
uses: ./.github/workflows/stackhpc-check-tags.yml
8486
with:
8587
kayobe_image: ${{ needs.build-kayobe-image.outputs.kayobe_image }}
88+
if: ${{ needs.check-changes.outputs.check-tags == 'true' }}
8689
secrets: inherit
87-
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
90+
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
8891

8992
all-in-one-ubuntu-jammy-ovs:
9093
name: aio (Ubuntu Jammy OVS)

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ etc/kayobe/environments/aufn-ceph/kolla/config/nova/ceph.client.glance.keyring
5656

5757
# Tempest logs
5858
tempest-artifacts
59+
60+
# Ansible Galaxy roles & collections
61+
etc/kayobe/ansible/roles/*\.*/
62+
etc/kayobe/ansible/collections/

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,34 @@ Next, configure the host OS & services.
101101
102102
kayobe seed host configure
103103
104+
.. _authenticating-pulp-proxy:
105+
106+
Authenticating Pulp proxy
107+
-------------------------
108+
109+
If you are building against authenticated package repositories such as those in
110+
`Ark <https://ark.stackhpc.com>`_, you will need to provide secure access to
111+
the repositories without leaking credentials into the built images or their
112+
metadata. This is typically not the case for a client-local Pulp, which
113+
provides unauthenticated read-only access to the repositories on a trusted
114+
network.
115+
116+
Docker provides `build
117+
secrets <https://docs.docker.com/build/building/secrets/>`_, but these must be
118+
explicitly requested for each RUN statement, making them challenging to use in
119+
Kolla.
120+
121+
StackHPC Kayobe Configuration provides support for deploying an authenticating
122+
Pulp proxy that injects an HTTP basic auth header into requests that it
123+
proxies. Because this proxy bypasses Pulp's authentication, it must not be
124+
exposed to any untrusted environment.
125+
126+
To deploy the proxy:
127+
128+
.. parsed-literal::
129+
130+
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/pulp-auth-proxy.yml
131+
104132
Building images
105133
===============
106134

@@ -111,6 +139,9 @@ At this point you are ready to build and push some container images.
111139
kayobe seed container image build --push
112140
kayobe overcloud container image build --push
113141
142+
If using an :ref:`authenticating Pulp proxy <authenticating-pulp-proxy>`,
143+
append ``-e stackhpc_repo_mirror_auth_proxy_enabled=true`` to these commands.
144+
114145
The container images are tagged as |current_release|-<datetime>.
115146

116147
To use the new images, edit

etc/kayobe/ansible/check-tags.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
set_fact:
1717
kolla_images: "{{ kolla_images_result.stdout | from_yaml }}"
1818

19-
- name: Set a fact about the Pulp URL
20-
set_fact:
21-
pulp_url: "{{ stackhpc_repo_mirror_url }}"
22-
2319
# Use state=read and allow_missing=false to check for missing tags in test pulp.
2420
- import_role:
2521
name: stackhpc.pulp.pulp_container_content
@@ -30,6 +26,7 @@
3026
{%- set repository = kolla_docker_namespace ~ "/" ~ image -%}
3127
{%- set content = {
3228
"allow_missing": False,
29+
"is_push": pulp_url == stackhpc_release_pulp_url,
3330
"repository": repository,
3431
"state": "read",
3532
"tags": tags,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
# See roles/pulp_auth_proxy/README.md for details.
3+
4+
- name: Deploy Pulp auth proxy
5+
hosts: container-image-builders
6+
gather_facts: false
7+
tasks:
8+
- import_role:
9+
name: pulp_auth_proxy
10+
vars:
11+
pulp_auth_proxy_url: "{{ stackhpc_repo_mirror_url }}"
12+
pulp_auth_proxy_username: "{{ stackhpc_repo_mirror_username }}"
13+
pulp_auth_proxy_password: "{{ stackhpc_repo_mirror_password }}"
14+
pulp_auth_proxy_conf_path: "{{ base_path }}/containers/pulp_proxy"

etc/kayobe/ansible/requirements.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ collections:
77
- name: pulp.squeezer
88
version: 0.0.13
99
- name: stackhpc.pulp
10-
version: 0.5.4
10+
version: 0.5.5
1111
- name: stackhpc.hashicorp
1212
version: 2.4.0
1313
- name: stackhpc.kayobe_workflows
14-
version: 1.0.2
14+
version: 1.0.3
1515
roles:
1616
- src: stackhpc.vxlan
1717
- name: ansible-lockdown.ubuntu22_cis

etc/kayobe/ansible/reset-bls-entries.yml

100755100644
File mode changed.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Pulp Auth Proxy
2+
3+
There is currently no practical, secure way to provide credentials for
4+
accessing Ark's authenticated package repositories from within a Kolla build.
5+
Docker provides [build
6+
secrets](https://docs.docker.com/build/building/secrets/), but these must be
7+
explicitly requested for each RUN statement, making them challenging to use in
8+
Kolla.
9+
10+
This role deploys an Nginx container that runs as a reverse proxy, injecting an
11+
HTTP basic authentication header into requests.
12+
13+
Because this proxy bypasses Pulp's authentication, it must not be exposed to
14+
any untrusted environment.
15+
16+
## Role variables
17+
18+
* `pulp_auth_proxy_pulp_url`: URL of the Pulp server to proxy requests to.
19+
* `pulp_auth_proxy_username`: Username of the Pulp server to proxy requests to.
20+
* `pulp_auth_proxy_password`: Password of the Pulp server to proxy requests to.
21+
* `pulp_auth_proxy_conf_path`: Path to a directory in which to write Nginx
22+
configuration.
23+
* `pulp_auth_proxy_listen_ip`: IP address on the Docker host on which to
24+
listen. Default is `127.0.0.1`.
25+
* `pulp_auth_proxy_listen_port`: Port on the Docker host on which to listen.
26+
Default is 80.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
pulp_auth_proxy_url:
3+
pulp_auth_proxy_username:
4+
pulp_auth_proxy_password:
5+
pulp_auth_proxy_conf_path:
6+
pulp_auth_proxy_listen_ip: 127.0.0.1
7+
pulp_auth_proxy_listen_port: 80
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
- name: "Ensure {{ pulp_auth_proxy_conf_path }} exists"
3+
ansible.builtin.file:
4+
path: "{{ pulp_auth_proxy_conf_path }}"
5+
state: directory
6+
mode: 0700
7+
become: true
8+
9+
- name: Ensure pulp_proxy.conf is templated
10+
ansible.builtin.template:
11+
src: pulp_proxy.conf.j2
12+
dest: "{{ pulp_auth_proxy_conf_path }}/pulp_proxy.conf"
13+
mode: 0600
14+
become: true
15+
register: pulp_proxy_conf
16+
17+
- name: Ensure pulp_proxy container is running
18+
community.docker.docker_container:
19+
name: pulp_proxy
20+
image: nginx:stable-alpine
21+
ports:
22+
- "{{ pulp_auth_proxy_listen_ip }}:{{ pulp_auth_proxy_listen_port }}:80"
23+
restart_policy: "no"
24+
restart: "{{ pulp_proxy_conf is changed }}"
25+
volumes:
26+
- "{{ pulp_auth_proxy_conf_path }}/pulp_proxy.conf:/etc/nginx/conf.d/default.conf:ro"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
server {
2+
listen {{ pulp_auth_proxy_listen_port }};
3+
server_name pulp_proxy;
4+
location / {
5+
proxy_pass {{ pulp_auth_proxy_url }};
6+
proxy_set_header X-Real-IP $remote_addr;
7+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
8+
proxy_set_header X-Forwarded-Proto $scheme;
9+
proxy_set_header Host {{ pulp_auth_proxy_url | urlsplit('hostname') }};
10+
# The important part: add basic auth header
11+
proxy_set_header Authorization "Basic {{ (pulp_auth_proxy_username ~ ':' ~ pulp_auth_proxy_password) | b64encode }}";
12+
proxy_pass_header Authorization;
13+
# See https://stackoverflow.com/questions/25329941/nginx-caching-proxy-fails-with-ssl23-get-server-hellosslv3-alert-handshake-fail/25330027#25330027
14+
proxy_ssl_server_name on;
15+
proxy_ssl_protocols TLSv1.2;
16+
}
17+
}

etc/kayobe/ansible/smartmon-tools.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- hosts: overcloud
33

44
tasks:
5-
- name: Ensure smartmon-tools, jq, nvme-cli and cron/cronie is installed
5+
- name: Ensure smartmontools, jq, nvme-cli and cron/cronie are installed
66
package:
77
name:
88
- smartmontools

etc/kayobe/environments/ci-builder/stackhpc-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ resolv_is_managed: false
4040
# Host and port of a package repository mirror.
4141
# Build against the development Pulp service repositories.
4242
# Use Ark's package repositories to install packages.
43-
stackhpc_repo_mirror_url: "{{ stackhpc_release_pulp_url }}"
43+
stackhpc_repo_mirror_url: "{{ stackhpc_repo_mirror_auth_proxy_url if stackhpc_repo_mirror_auth_proxy_enabled | bool else stackhpc_release_pulp_url }}"
4444
stackhpc_repo_mirror_username: "{{ stackhpc_docker_registry_username }}"
4545
stackhpc_repo_mirror_password: "{{ stackhpc_docker_registry_password }}"
4646

0 commit comments

Comments
 (0)