Skip to content

Commit 5bb0ae9

Browse files
committed
convert dnsmasq to serve dns only
1 parent 5c19881 commit 5bb0ae9

9 files changed

Lines changed: 16 additions & 404 deletions

File tree

components/ironic/dnsmasq-cm.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,11 @@ kind: ConfigMap
33
metadata:
44
name: ironic-dnsmasq
55
data:
6-
# interface to listen on the host
7-
PROVISIONER_INTERFACE: "eth0"
8-
# common separated list of DHCP tagged configs
9-
DHCP_TAGS: tag1
10-
# When defining the IP address range, make sure to include subnet
11-
# information, especially for the pools serving relayed requests
12-
DHCP_RANGE_TAG1: 192.168.200.4,192.168.200.12,255.255.255.0,192.168.200.255,30m
13-
DHCP_OPTION_TAG1_ROUTER: 192.168.200.1
146
# external IP address of Ingress. Used to populate DNS A records for the
157
# Understack components
168
INGRESS_IP: 192.168.1.177
9+
# DNS zone suffix for wildcard A record pointing to INGRESS_IP
10+
DNS_ZONE: understack.local
1711
DNS_PORT: '53'
18-
LOG_DNS_QUERIES: 'true'
19-
LOG_DHCP_QUERIES: 'true'
2012
# If you want to print rendered dnsmasq.conf in the logs
2113
# DEBUG_DNSMASQ_CONF: "yes"
Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,16 @@ spec:
1010
- name: dns
1111
port: 53
1212
protocol: UDP
13-
- name: dhcp
14-
port: 67
15-
protocol: UDP
1613
clusterIP: None
1714
selector:
1815
application: ironic-dnsmasq
1916
---
2017
apiVersion: apps/v1
21-
kind: StatefulSet
18+
kind: Deployment
2219
metadata:
2320
name: ironic-dnsmasq
2421
namespace: openstack
2522
spec:
26-
serviceName: ironic-dnsmasq
2723
replicas: 1
2824
selector:
2925
matchLabels:
@@ -33,8 +29,6 @@ spec:
3329
labels:
3430
application: ironic-dnsmasq
3531
spec:
36-
nodeSelector:
37-
dhcp_role: server
3832
hostNetwork: true
3933
containers:
4034
- name: dnsmasq
@@ -43,8 +37,7 @@ spec:
4337
allowPrivilegeEscalation: false
4438
readOnlyRootFilesystem: true
4539
capabilities:
46-
# needed for privileged ports and to send ICMP packets
47-
add: ["NET_ADMIN", "NET_RAW"]
40+
add: ["NET_BIND_SERVICE"]
4841
args:
4942
- /usr/sbin/dnsmasq
5043
- '--no-daemon'
@@ -56,25 +49,13 @@ spec:
5649
- name: dns
5750
containerPort: 53
5851
protocol: UDP
59-
- name: dhcp
60-
containerPort: 67
61-
protocol: UDP
62-
- name: tftp
63-
containerPort: 69
64-
protocol: UDP
6552
volumeMounts:
6653
- name: pod-tmp
6754
mountPath: /tmp
6855
- name: pod-dnsmasq-d
6956
mountPath: /etc/dnsmasq.d
70-
- name: pod-dhcp
71-
mountPath: /var/lib/misc
7257
volumes:
7358
- name: pod-tmp
7459
emptyDir: {}
7560
- name: pod-dnsmasq-d
76-
persistentVolumeClaim:
77-
claimName: dnsmasq-ironic
78-
- name: pod-dhcp
79-
persistentVolumeClaim:
80-
claimName: dnsmasq-dhcp
61+
emptyDir: {}

components/ironic/dnsmasq-pvc.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

components/ironic/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ kind: Kustomization
55
resources:
66
- ironic-mariadb-db.yaml
77
- ironic-rabbitmq-queue.yaml
8-
- dnsmasq-pvc.yaml
9-
# - dnsmasq-ss.yaml
8+
- dnsmasq-cm.yaml
9+
- dnsmasq-deploy.yaml
1010
- ironic-ks-user-baremetal.yaml
1111
# less than ideal addition but necessary so that we can have the ironic.conf.d loading
1212
# working due to the way the chart hardcodes the config-file parameter which then

components/ironic/values.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,22 +242,12 @@ pod:
242242
ironic_conductor:
243243
ironic_conductor:
244244
volumeMounts:
245-
- name: dnsmasq-ironic
246-
mountPath: /etc/dnsmasq.d/
247-
- name: dnsmasq-dhcp
248-
mountPath: /var/lib/dnsmasq/
249245
- name: device-types
250246
mountPath: /var/lib/understack/device-types
251247
- name: ironic-inspection-rules
252248
mountPath: /etc/ironic/inspection-rules/
253249
readOnly: true
254250
volumes:
255-
- name: dnsmasq-ironic
256-
persistentVolumeClaim:
257-
claimName: dnsmasq-ironic
258-
- name: dnsmasq-dhcp
259-
persistentVolumeClaim:
260-
claimName: dnsmasq-dhcp
261251
- name: device-types
262252
configMap:
263253
name: device-types

containers/dnsmasq/Dockerfile

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,12 @@
11
# syntax=docker/dockerfile:1
2-
FROM debian:bookworm-20240408-slim AS builder
2+
FROM debian:forky-slim AS prod
33

4-
ENV DEBFULLNAME="Marek Skrobacki"
5-
ENV DEBEMAIL="marek.skrobacki@rackspace.co.uk"
6-
ENV QUILT_PATCHES=debian/patches
7-
8-
RUN echo "deb-src http://deb.debian.org/debian bookworm main" > /etc/apt/sources.list
9-
RUN apt-get update && apt-get -y install \
10-
build-essential \
11-
devscripts \
12-
fakeroot \
13-
debhelper \
14-
automake \
15-
autotools-dev \
16-
pkg-config \
17-
ca-certificates \
18-
quilt \
19-
ipxe \
20-
--no-install-recommends
21-
WORKDIR /src
22-
RUN apt-get -y build-dep dnsmasq
23-
RUN apt-get -y source dnsmasq
24-
# copy in our patch
25-
COPY containers/dnsmasq/dnsmasq/dhcp-allowed-srvids.patch /src/
26-
# setup the patch to be built into the quilt file
27-
# set our version number to a local override suffixed by '.uc1'
28-
RUN cd /src/dnsmasq-* && \
29-
mkdir -p debian/patches && \
30-
mv /src/dhcp-allowed-srvids.patch debian/patches && \
31-
dch -l .uc "patched for dhcp-allowed-srvids" && \
32-
echo dhcp-allowed-srvids.patch >> debian/patches/series && \
33-
quilt push -a
34-
# build it
35-
RUN cd /src/dnsmasq-* && dpkg-buildpackage -rfakeroot
36-
37-
38-
FROM debian:bookworm-20240408-slim AS prod
39-
40-
LABEL org.opencontainers.image.description="dnsmasq for Understack's Ironic"
41-
42-
COPY --from=builder /src/dnsmasq-base_*_amd64.deb /tmp
43-
COPY --from=builder /src/dnsmasq_*_all.deb /tmp
4+
LABEL org.opencontainers.image.description="dnsmasq DNS-only for Understack"
445

456
RUN apt-get update && \
46-
apt-get -y install --no-install-recommends python3-jinja2 ipxe && \
47-
apt-get -y --fix-broken install --no-install-recommends /tmp/dnsmasq-base_*_amd64.deb /tmp/dnsmasq_*_all.deb && \
7+
apt-get -y install --no-install-recommends dnsmasq-base python3-jinja2 && \
488
apt-get clean && \
49-
rm -rf /var/lib/apt/lists/* /tmp/*.deb
50-
51-
RUN mkdir -p /var/lib/openstack-helm/tftpboot && \
52-
cp /usr/lib/ipxe/snponly.efi /var/lib/openstack-helm/tftpboot/
9+
rm -rf /var/lib/apt/lists/*
5310

5411
COPY containers/dnsmasq/common/helpers.sh /helpers.sh
5512
COPY containers/dnsmasq/dnsmasq/entry-point.sh /entry-point.sh

containers/dnsmasq/dnsmasq/dhcp-allowed-srvids.patch

Lines changed: 0 additions & 173 deletions
This file was deleted.

0 commit comments

Comments
 (0)