Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't bind coredns to publicip #2787

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ services:
image: coredns/coredns:1.10.1
command: -conf /root/dnsconfig/Corefile
env_file: ./netmaker.env
restart: always
depends_on:
- netmaker
volumes:
Expand Down
2 changes: 1 addition & 1 deletion controllers/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func hostUpdateFallback(w http.ResponseWriter, r *http.Request) {
return
}
case models.UpdateMetrics:
mq.UpdateMetricsFallBack(hostUpdate.Node.ID.String(), hostUpdate.NewMetrics)
// mq.UpdateMetricsFallBack(hostUpdate.Node.ID.String(), hostUpdate.NewMetrics)
}
logic.ReturnSuccessResponse(w, r, "updated host data")

Expand Down
15 changes: 4 additions & 11 deletions functions/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,16 @@ func SetDNSDir() error {
return err
}

_, err = os.Stat(dir + "/config/dnsconfig")
if os.IsNotExist(err) {
err = os.MkdirAll(dir+"/config/dnsconfig", 0744)
}
err = os.MkdirAll(dir+"/config/dnsconfig", 0744)
if err != nil {
logger.Log(0, "couldnt find or create /config/dnsconfig")
return err
}

_, err = os.Stat(dir + "/config/dnsconfig/Corefile")
if os.IsNotExist(err) {
err = logic.SetCorefile(".")
if err != nil {
logger.Log(0, err.Error())
}
err = logic.SetCorefile(".")
if err != nil {
logger.Log(0, err.Error())
}

_, err = os.Stat(dir + "/config/dnsconfig/netmaker.hosts")
if os.IsNotExist(err) {
_, err = os.Create(dir + "/config/dnsconfig/netmaker.hosts")
Expand Down
10 changes: 2 additions & 8 deletions logic/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/gravitl/netmaker/database"
"github.com/gravitl/netmaker/logger"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/servercfg"
"github.com/txn2/txeh"
)

Expand Down Expand Up @@ -159,17 +158,13 @@ func SetCorefile(domains string) error {
return err
}

_, err = os.Stat(dir + "/config/dnsconfig")
if os.IsNotExist(err) {
err = os.MkdirAll(dir+"/config/dnsconfig", 0744)
}
err = os.MkdirAll(dir+"/config/dnsconfig", 0744)
if err != nil {
logger.Log(0, "couldnt find or create /config/dnsconfig")
return err
}

corefile := domains + ` {
bind %s
reload 15s
hosts /root/dnsconfig/netmaker.hosts {
fallthrough
Expand All @@ -178,8 +173,7 @@ func SetCorefile(domains string) error {
log
}
`
corebytes := []byte(fmt.Sprintf(corefile, servercfg.GetCoreDNSAddr()))
err = os.WriteFile(dir+"/config/dnsconfig/Corefile", corebytes, 0644)
err = os.WriteFile(dir+"/config/dnsconfig/Corefile", []byte(corefile), 0644)
if err != nil {
return err
}
Expand Down
3 changes: 3 additions & 0 deletions pro/logic/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ func updateNodeMetrics(currentNode *models.Node, newMetrics *models.Metrics) {
attachedClients = clients
}
}
if newMetrics.Connectivity == nil {
newMetrics.Connectivity = make(map[string]models.Metric)
}
if len(attachedClients) > 0 {
// associate ext clients with IDs
for i := range attachedClients {
Expand Down