Skip to content

Commit bacaf8f

Browse files
jovialmnasiadka
authored andcommitted
Adds ironic-pxe-filter container
Used in conjunction with the inspector implementation built into Ironic and based on the Ironic documentation[1]. [1] https://docs.openstack.org/ironic/latest/admin/inspection/pxe_filter.html Partial-Bug: #2094790 Depends-On: https://review.opendev.org/c/openstack/ironic/+/959850 Change-Id: I17811f2225edd64fb20cc44f0d40e14e9edb1413 Signed-off-by: Michal Nasiadka <[email protected]> Signed-off-by: Will Szumski <[email protected]>
1 parent 0d51f0a commit bacaf8f

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

docker/dnsmasq/extend_start.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
DNSMASQ_PIDFILE=${DNSMASQ_PIDFILE:-/run/ironic/dnsmasq.pid}
4+
DNSMASQ_PIDFILE_DIR="$(dirname $DNSMASQ_PIDFILE)"
5+
36
if [[ ! -d "/var/log/kolla/ironic" ]]; then
47
mkdir -p /var/log/kolla/ironic
58
fi
@@ -10,3 +13,19 @@ if [[ ! -r "/var/log/kolla/ironic/dnsmasq.log" ]]; then
1013
touch /var/log/kolla/ironic/dnsmasq.log
1114
chown ironic:ironic /var/log/kolla/ironic/dnsmasq.log
1215
fi
16+
17+
if [[ ! -d "$DNSMASQ_PIDFILE_DIR" ]]; then
18+
mkdir -p "$DNSMASQ_PIDFILE_DIR"
19+
fi
20+
21+
# NOTE(wszumski): This writes the PID of dnsmasq out to a file. The PIDFILE can be used in
22+
# another container to send a signal to dnsmasq to reload its config (providing that the two
23+
# containers share a PID namespace). The concrete use case is for the Ironic PXE filter to
24+
# clean up stale host entries on startup as documented in:
25+
#
26+
# https://docs.openstack.org/ironic/latest/admin/inspection/pxe_filter.html
27+
#
28+
# We cannot use the pid-file option in dnsmasq, since it will only write the PIDFILE if you
29+
# run dnsmasq in its non-forking mode i.e you do use the --no-daemon or --keep-in-foreground
30+
# options.
31+
echo $$ > "$DNSMASQ_PIDFILE"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM {{ namespace }}/{{ image_prefix }}ironic-base:{{ tag }}
2+
{% block labels %}
3+
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
4+
{% endblock %}
5+
6+
{% block ironic_pxe_filter_header %}{% endblock %}
7+
8+
{% import "macros.j2" as macros with context %}
9+
10+
{% set ironic_pxe_filter_packages = [] %}
11+
12+
{% set ironic_pxe_filter_pip_packages = [] %}
13+
14+
RUN {{ macros.install_pip(ironic_pxe_filter_pip_packages | customizable("pip_packages")) }}
15+
16+
{{ macros.install_packages(ironic_pxe_filter_packages | customizable("packages")) }}
17+
18+
{{ macros.kolla_patch_sources() }}
19+
20+
COPY extend_start.sh /usr/local/bin/kolla_ironic_extend_start
21+
RUN chmod 644 /usr/local/bin/kolla_ironic_extend_start
22+
23+
{% block ironic_pxe_filter_footer %}{% endblock %}
24+
{% block footer %}{% endblock %}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
IRONIC_DHCP_HOSTS_DIR=${IRONIC_DHCP_HOSTS_DIR:-/etc/dnsmasq/dhcp-hostsdir}
3+
DNSMASQ_PIDFILE=${DNSMASQ_PIDFILE:-/run/ironic/dnsmasq.pid}
4+
5+
# NOTE(wszumski): This container must be in same process namespace as dnsmasq
6+
rm -f $IRONIC_DHCP_HOSTS_DIR/* && kill -HUP $(cat "$DNSMASQ_PIDFILE") || true
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
features:
3+
- |
4+
Adds ``ironic-pxe-filter`` container image.

0 commit comments

Comments
 (0)