Browse Source

add bind address to coredns container

Abhishek Kondur 1 year ago
parent
commit
137a7abe5d
1 changed files with 3 additions and 2 deletions
  1. 3 2
      logic/dns.go

+ 3 - 2
logic/dns.go

@@ -11,6 +11,7 @@ import (
 	"github.com/gravitl/netmaker/database"
 	"github.com/gravitl/netmaker/database"
 	"github.com/gravitl/netmaker/logger"
 	"github.com/gravitl/netmaker/logger"
 	"github.com/gravitl/netmaker/models"
 	"github.com/gravitl/netmaker/models"
+	"github.com/gravitl/netmaker/servercfg"
 	"github.com/txn2/txeh"
 	"github.com/txn2/txeh"
 )
 )
 
 
@@ -168,6 +169,7 @@ func SetCorefile(domains string) error {
 	}
 	}
 
 
 	corefile := domains + ` {
 	corefile := domains + ` {
+	bind %s
     reload 15s
     reload 15s
     hosts /root/dnsconfig/netmaker.hosts {
     hosts /root/dnsconfig/netmaker.hosts {
 	fallthrough	
 	fallthrough	
@@ -176,8 +178,7 @@ func SetCorefile(domains string) error {
     log
     log
 }
 }
 `
 `
-	corebytes := []byte(corefile)
-
+	corebytes := []byte(fmt.Sprintf(corefile, servercfg.GetCoreDNSAddr()))
 	err = os.WriteFile(dir+"/config/dnsconfig/Corefile", corebytes, 0644)
 	err = os.WriteFile(dir+"/config/dnsconfig/Corefile", corebytes, 0644)
 	if err != nil {
 	if err != nil {
 		return err
 		return err