Skip to content

Commit

Permalink
[DO-NOT-MERGE] hack to add etcd SRV record for some experimentation
Browse files Browse the repository at this point in the history
  • Loading branch information
GoelDeepak committed Apr 10, 2019
1 parent 65cb06f commit f2d49bf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions records/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ func (rg *RecordGenerator) InsertState(sj state.State, domain, ns, listener stri
rg.slaveRecords(sj, domain, spec)
rg.listenerRecord(listener, ns)
rg.masterRecord(domain, masters, sj.Leader)
rg.etcdRecord(domain, masters)
rg.taskRecords(sj, domain, spec, ipSources)

return nil
Expand Down Expand Up @@ -357,6 +358,21 @@ func (rg *RecordGenerator) masterRecord(domain string, masters []string, leader
}
}

// SRV record for etcd
func (rg *RecordGenerator) etcdRecord(domain string, masters []string) {
server := "_etcd-server._tcp." + domain + "."
client := "_etcd-client._tcp." + domain + "."
for _, master := range masters {
masterIP, _, err := urls.SplitHostPort(master)
if err != nil {
logging.Error.Println(err)
continue
}
rg.insertRR(client, masterIP + ":2379", SRV)
rg.insertRR(server, masterIP + ":2380", SRV)
}
}

// A or AAAA record for mesos-dns (the name is listed in SOA replies)
func (rg *RecordGenerator) listenerRecord(listener string, ns string) {
if listener == "0.0.0.0" {
Expand Down

0 comments on commit f2d49bf

Please sign in to comment.