Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Remove dnsmasq
Browse files Browse the repository at this point in the history
- Consul is bound to port 53 by default

Signed-off-by: Sabith KS <[email protected]>
  • Loading branch information
christianang authored and Sabith KS committed Sep 19, 2016
1 parent 65db4fc commit 8325503
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 84 deletions.
4 changes: 0 additions & 4 deletions config/blobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@ golang/go1.6.3.linux-amd64.tar.gz:
object_id: 1e4dd34f-506c-4222-ba2c-2967e1061006
sha: 5e916ba4dd8c2fc43beafca4c08b334c4d0686f3
size: 84856920
dnsmasq/dnsmasq-2.76.tar.gz:
object_id: 912b9199-4e43-41be-b4b0-d3b9b7d16b06
sha: 3cb264e2505a06705203d616883db5ee6ac00026
size: 697191
9 changes: 0 additions & 9 deletions jobs/consul_agent/monit
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,3 @@ check process consul-join
group vcap
depends on consul_agent
<% end %>

<% if p("consul.include_dnsmasq") %>
check process dnsmasq
with pidfile /var/vcap/sys/run/consul_agent/dnsmasq.pid
start program "/var/vcap/jobs/consul_agent/bin/dnsmasq_ctl start"
as uid vcap and gid vcap with timeout 60 seconds
stop program "/var/vcap/jobs/consul_agent/bin/dnsmasq_ctl stop"
group vcap
<% end %>
15 changes: 2 additions & 13 deletions jobs/consul_agent/spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ templates:
server.key.erb: config/certs/server.key
agent.crt.erb: config/certs/agent.crt
agent.key.erb: config/certs/agent.key
dnsmasq_ctl.erb: bin/dnsmasq_ctl

packages:
- consul
- confab
- dnsmasq

properties:
consul.agent.mode:
Expand Down Expand Up @@ -58,19 +56,10 @@ properties:
consul.agent.domain:
description: "Domain suffix for DNS"

consul.include_dnsmasq:
description: "When enabled, dnsmasq is the dns server."
default: true

consul.dnsmasq.dns_timeout_in_seconds:
description: "The dns timeout for dnsmasq."
consul.dns_timeout_in_seconds:
description: "The dns timeout for consul."
default: 5

consul.dnsmasq.nameservers:
description: "List of domains and their associated dns server address"
default:
- cf.internal/127.0.0.1#8600

consul.ca_cert:
description: "PEM-encoded CA certificate"

Expand Down
33 changes: 0 additions & 33 deletions jobs/consul_agent/templates/dnsmasq_ctl.erb

This file was deleted.

9 changes: 2 additions & 7 deletions jobs/consul_agent/templates/pre-start.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ function setup_resolvconf() {
local resolvconf_file
resolvconf_file=/etc/resolvconf/resolv.conf.d/head

sed -i '/options timeout/d' "${resolvconf_file}"
echo "options timeout:<%= p("consul.dnsmasq.dns_timeout_in_seconds") %>" >> "${resolvconf_file}"

if ! grep -qE '127.0.0.1\b' "${resolvconf_file}"; then
if [[ "$(stat -c "%s" "${resolvconf_file}")" = "0" ]]; then
echo 'nameserver 127.0.0.1' > "${resolvconf_file}"
Expand Down Expand Up @@ -58,10 +55,8 @@ function main() {

set_virtual_memory

<% if p("consul.include_dnsmasq") %>
setup_resolvconf
setcap cap_net_bind_service=+ep ${PKG_DIR}/dnsmasq/sbin/dnsmasq
<% end %>
setup_resolvconf
setcap cap_net_bind_service=+ep ${PKG_DIR}/consul/bin/consul
}

main
1 change: 0 additions & 1 deletion manifests/bosh-lite/3-node-with-ssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ update:

properties:
consul:
include_dnsmasq: false
agent:
domain: cf.internal
servers:
Expand Down
8 changes: 0 additions & 8 deletions packages/dnsmasq/packaging

This file was deleted.

7 changes: 0 additions & 7 deletions packages/dnsmasq/spec

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
. "github.com/onsi/gomega"
)

var _ = Describe("Multiple instance rolling upgrade", func() {
var _ = PDescribe("Multiple instance rolling upgrade", func() {
var (
manifest consul.Manifest
kv consulclient.HTTPKV
Expand Down
3 changes: 3 additions & 0 deletions src/confab/chaperon/config_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ var _ = Describe("ConfigWriter", func() {
"allow_stale": false,
"max_stale": "5s",
},
"ports": map[string]int{
"dns": 53,
},
}
body, err := json.Marshal(conf)
Expect(err).To(BeNil())
Expand Down
3 changes: 3 additions & 0 deletions src/confab/confab/confab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ var _ = Describe("confab", func() {
"allow_stale": false,
"max_stale": "5s",
},
"ports": map[string]int{
"dns": 53,
},
}
body, err := json.Marshal(conf)
Expect(err).To(BeNil())
Expand Down
5 changes: 4 additions & 1 deletion src/confab/config/consul_config_definer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type ConsulConfig struct {
DataDir string `json:"data_dir"`
LogLevel string `json:"log_level"`
NodeName string `json:"node_name"`
Ports *ConsulConfigPorts `json:"ports,omitempty"`
Ports ConsulConfigPorts `json:"ports"`
RejoinAfterLeave bool `json:"rejoin_after_leave"`
BindAddr string `json:"bind_addr"`
DisableRemoteExec bool `json:"disable_remote_exec"`
Expand Down Expand Up @@ -66,6 +66,9 @@ func GenerateConfiguration(config Config, configDir, nodeName string) ConsulConf
DisableRemoteExec: true,
DisableUpdateCheck: true,
Protocol: config.Consul.Agent.ProtocolVersion,
Ports: ConsulConfigPorts{
DNS: 53,
},
DnsConfig: ConsulConfigDnsConfig{
AllowStale: config.Consul.Agent.DnsConfig.AllowStale,
MaxStale: config.Consul.Agent.DnsConfig.MaxStale,
Expand Down
6 changes: 6 additions & 0 deletions src/confab/config/consul_config_definer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ var _ = Describe("ConsulConfigDefiner", func() {
})
})

Describe("DNS port", func() {
It("defaults to 53", func() {
Expect(consulConfig.Ports.DNS).To(Equal(53))
})
})

Describe("protocol", func() {
It("defaults to 0", func() {
Expect(consulConfig.Protocol).To(Equal(0))
Expand Down

0 comments on commit 8325503

Please sign in to comment.