Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

[v0.14.x] Configurable CoreDNS TTL #1626

Merged
merged 1 commit into from
Jun 18, 2019
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
3 changes: 3 additions & 0 deletions builtin/files/cluster.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,9 @@ kubeDns:
# - --neg-ttl=10
# - --no-ping

# When enabled, will modify the TTL of the coredns service.
# ttl: 30

# When enabled, will deploy kube-dns to K8s controllers instead of workers.
# deployToControllers: false

Expand Down
3 changes: 2 additions & 1 deletion builtin/files/userdata/cloud-config-controller
Original file line number Diff line number Diff line change
Expand Up @@ -3784,13 +3784,14 @@ write_files:
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
ttl {{ .KubeDns.TTL }}
}
forward . /etc/resolv.conf {
except cluster.local
health_check 5s
}
prometheus :9153
cache 30
cache {{ .KubeDns.TTL }}
loop
reload
loadbalance
Expand Down
1 change: 1 addition & 0 deletions pkg/api/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func NewDefaultCluster() *Cluster {
Provider: "coredns",
NodeLocalResolver: false,
DeployToControllers: false,
TTL: 30,
Autoscaler: KubeDnsAutoscaler{
CoresPerReplica: 256,
NodesPerReplica: 16,
Expand Down
1 change: 1 addition & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ type KubeDns struct {
NodeLocalResolver bool `yaml:"nodeLocalResolver"`
NodeLocalResolverOptions []string `yaml:"nodeLocalResolverOptions"`
DeployToControllers bool `yaml:"deployToControllers"`
TTL int `yaml:"ttl"`
Autoscaler KubeDnsAutoscaler `yaml:"autoscaler"`
}

Expand Down
22 changes: 22 additions & 0 deletions pkg/model/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@ func TestKubeDns(t *testing.T) {
Provider: "coredns",
NodeLocalResolver: false,
DeployToControllers: false,
TTL: 30,
Autoscaler: api.KubeDnsAutoscaler{
CoresPerReplica: 256,
NodesPerReplica: 16,
Expand All @@ -1139,6 +1140,7 @@ kubeDns:
Provider: "coredns",
NodeLocalResolver: false,
DeployToControllers: false,
TTL: 30,
Autoscaler: api.KubeDnsAutoscaler{
CoresPerReplica: 256,
NodesPerReplica: 16,
Expand All @@ -1160,6 +1162,7 @@ kubeDns:
Provider: "coredns",
NodeLocalResolver: true,
DeployToControllers: true,
TTL: 30,
Autoscaler: api.KubeDnsAutoscaler{
CoresPerReplica: 5,
NodesPerReplica: 10,
Expand All @@ -1176,6 +1179,25 @@ kubeDns:
Provider: "coredns",
NodeLocalResolver: false,
DeployToControllers: false,
TTL: 30,
Autoscaler: api.KubeDnsAutoscaler{
CoresPerReplica: 256,
NodesPerReplica: 16,
Min: 2,
},
},
},
{
conf: `
kubeDns:
provider: coredns
ttl: 5
`,
kubeDns: api.KubeDns{
Provider: "coredns",
NodeLocalResolver: false,
DeployToControllers: false,
TTL: 5,
Autoscaler: api.KubeDnsAutoscaler{
CoresPerReplica: 256,
NodesPerReplica: 16,
Expand Down