Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Configure CoreDNS to shut down gracefully
This commit fixes bug 1884053.

https://bugzilla.redhat.com/show_bug.cgi?id=1884053

* assets/dns/daemonset.yaml: Specify a termination grace period of 120
seconds.  Change the readiness probe to use :8181/ready.
* pkg/manifests/bindata.go: Regenerate.
* pkg/operator/controller/controller_dns_configmap.go: (corefileTemplate):
Configure CoreDNS's health plugin to sleep 60 seconds when CoreDNS is shut
down.  Enable CoreDNS's ready plugin in order to provide a readiness
endpoint on :8181/ready, which stops responding when CoreDNS is shutting
down.
* pkg/operator/controller/controller_dns_configmap_test.go
(TestDesiredDNSConfigmap): Adjust for changes to corefileTemplate.
* pkg/operator/controller/controller_dns_daemonset.go
(daemonsetConfigChanged): Check if the readiness probe or termination grace
period changed, and update them if they did.
* pkg/operator/controller/controller_dns_daemonset_test.go
(TestDaemonsetConfigChanged): Add test cases to verify that
deploymentConfigChanged detects updates to
.spec.template.spec.containers[].readinessProbe.httpGet and
.spec.template.spec.terminationGracePeriodSeconds.
  • Loading branch information
Miciah committed Oct 8, 2020
1 parent 889561f commit f094ddf
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 11 deletions.
5 changes: 3 additions & 2 deletions assets/dns/daemonset.yaml
Expand Up @@ -26,8 +26,8 @@ spec:
protocol: TCP
readinessProbe:
httpGet:
path: /health
port: 8080
path: /ready
port: 8181
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
Expand Down Expand Up @@ -152,6 +152,7 @@ spec:
dnsPolicy: Default
nodeSelector:
kubernetes.io/os: linux
terminationGracePeriodSeconds: 120
volumes:
- name: config-volume
configMap:
Expand Down
8 changes: 4 additions & 4 deletions pkg/manifests/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pkg/operator/controller/controller_dns_configmap.go
Expand Up @@ -31,7 +31,10 @@ var corefileTemplate = template.Must(template.New("Corefile").Parse(`{{range .Se
{{end -}}
.:5353 {
errors
health
health {
lameduck 60s
}
ready
kubernetes {{.ClusterDomain}} in-addr.arpa ip6.arpa {
pods insecure
upstream
Expand Down
5 changes: 4 additions & 1 deletion pkg/operator/controller/controller_dns_configmap_test.go
Expand Up @@ -43,7 +43,10 @@ bar.com:5353 example.com:5353 {
}
.:5353 {
errors
health
health {
lameduck 60s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream
Expand Down

0 comments on commit f094ddf

Please sign in to comment.