diff --git a/pkg/zonemgr/internal/zone-file-cache/zone_file_cache.go b/pkg/zonemgr/internal/zone-file-cache/zone_file_cache.go index af37625..2873180 100644 --- a/pkg/zonemgr/internal/zone-file-cache/zone_file_cache.go +++ b/pkg/zonemgr/internal/zone-file-cache/zone_file_cache.go @@ -114,20 +114,29 @@ func buildARecordsArr(name string, namespace string, interfaces []v1.VirtualMach IPs := iface.IPs for _, IP := range IPs { if net.IsIPv4String(IP) { - recordsArr = append(recordsArr, generateARecord(name, namespace, iface.Name, IP)) + recordsArr = append(recordsArr, generateIfaceARecord(name, namespace, iface.Name, IP)) + defaultIP := IP break } } } + if defaultIP != nil { + recordsArr = append(recordsArr, generateDefaultARecord(name, namespace, defaultIP)) + } sort.Strings(recordsArr) return recordsArr } -func generateARecord(name string, namespace string, ifaceName string, ifaceIP string) string { +func generateIfaceARecord(name string, namespace string, ifaceName string, ifaceIP string) string { fqdn := fmt.Sprintf("%s.%s.%s", ifaceName, name, namespace) return fmt.Sprintf("%s IN A %s\n", fqdn, ifaceIP) } +func generateDefaultARecord(name string, namespace string, ifaceIP string) string { + fqdn := fmt.Sprintf("%s.%s", name, namespace) + return fmt.Sprintf("%s IN A %s\n", fqdn, ifaceIP) +} + func (zoneFileCache ZoneFileCache) generateARecords() string { aRecords := "" for _, recordsArr := range zoneFileCache.vmiRecordsMap {