Skip to content

Commit d2e75aa

Browse files
sutaakaropenshift-merge-bot[bot]
authored andcommitted
Use Dnsmasq to provide DNS for KinD
1 parent 8ab7f86 commit d2e75aa

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

github-actions/kind/action.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,22 @@ runs:
6767
kubectl annotate ingressclass nginx "ingressclass.kubernetes.io/is-default-class=true"
6868
kubectl -n ingress-nginx wait --timeout=300s --for=condition=Available deployments --all
6969
70-
- name: Add ${{ inputs.node-hostname }} host to machine hosts
70+
- name: Setup Dnsmasq to resolve hostnames with domain name ${{ inputs.node-hostname }}
7171
shell: bash
72-
run: echo "127.0.0.1 ${{ inputs.node-hostname }}" | sudo tee -a /etc/hosts
72+
run: |
73+
# Based on https://sixfeetup.com/blog/local-development-with-wildcard-dns-on-linux
74+
sudo apt-get install dnsmasq
75+
76+
sudo sed -i -E "s/#DNS=/DNS=127.0.0.2/" /etc/systemd/resolved.conf
77+
sudo sed -i -E "s/#Domains=/Domains=~${{ inputs.node-hostname }}/" /etc/systemd/resolved.conf
78+
sudo systemctl restart systemd-resolved
79+
80+
sudo sed -i -E "s/#IGNORE_RESOLVCONF=yes/IGNORE_RESOLVCONF=yes/" /etc/default/dnsmasq
81+
sudo sed -i -E "s/#listen-address=/listen-address=127.0.0.2/" /etc/dnsmasq.conf
82+
sudo sed -i -E "s/#bind-interfaces/bind-interfaces/" /etc/dnsmasq.conf
83+
sudo sed -i -E "s|#(address=).*|\1/${{ inputs.node-hostname }}/127.0.0.1|" /etc/dnsmasq.conf
84+
sudo systemctl restart dnsmasq
85+
systemctl status dnsmasq
7386
7487
- name: Set env variables for tests to properly leverage KinD cluster
7588
shell: bash

0 commit comments

Comments
 (0)