Add dns configuration to network overlays

Closes #922

Signed-off-by: Xu Yang <xyang@ciq.com>
This commit is contained in:
Xu Yang
2024-02-07 17:30:33 -07:00
committed by Jonathon Anderson
parent 31a6a3595c
commit 085b413d63
4 changed files with 32 additions and 0 deletions

View File

@@ -65,6 +65,16 @@ address={{ $netdev.IpCIDR }}
gateway={{ $netdev.Gateway }}
{{ end -}}
method=manual
{{- $dns := "" }}
{{range $tk, $tv := $netdev.Tags -}}
{{ $prefix := slice $tk 0 3 -}}
{{ if eq $prefix "DNS" -}}
{{ $dns = print $dns $tv ";" -}}
{{ end -}}
{{ end -}}
{{ if ne $dns "" -}}
dns={{$dns}}
{{ end -}}
{{ end -}}
{{/* always autoconfigure ipv6 */}}

View File

@@ -0,0 +1,15 @@
{{- $host := .BuildHost }}
{{- $time := .BuildTime }}
{{- $source := .BuildSource }}
# This file is autogenerated by warewulf
# Host: {{ $host }}
# Time: {{ $time }}
# Source: {{ $source }}
{{range $devname, $netdev := .NetDevs -}}
{{range $tk, $tv := $netdev.Tags -}}
{{ $prefix := slice $tk 0 3 -}}
{{ if eq $prefix "DNS" -}}
nameserver {{ $tv }}
{{ end -}}
{{ end -}}
{{ end -}}

View File

@@ -37,4 +37,10 @@ IPV6_FAILURE_FATAL=no
{{ if $netdev.Ipaddr6 -}}
IPV6ADDR="{{ $netdev.Ipaddr6 }}"
{{ end -}}
{{range $tk, $tv := $netdev.Tags -}}
{{ $prefix := slice $tk 0 3 -}}
{{ if eq $prefix "DNS" -}}
{{ $tk }}={{ $tv }}
{{ end -}}
{{ end -}}
{{ end -}}