Moved Corefile template to a const
@@ -248,8 +248,14 @@ func (dns *boshDomainNameService) createCorefile(namespace string) string {
}
}
+ tmpl := template.Must(template.New("Corefile").Parse(corefileTemplate))
+ var config strings.Builder
+ tmpl.Execute(&config, rewrites)
+ return config.String()
+}
+
// The Corefile values other than the rewrites were based on the default cluster CoreDNS Corefile.
- tmpl := template.Must(template.New("Corefile").Parse(`
+const corefileTemplate = `
.:8053 {
errors
health
@@ -261,12 +267,7 @@ func (dns *boshDomainNameService) createCorefile(namespace string) string {
loop
reload
loadbalance
- }`))
-
- var config strings.Builder
- tmpl.Execute(&config, rewrites)
- return config.String()
-}
+}`
// simpleDomainNameService emulates old behaviour without BOSH DNS.
// TODO: Is this implementation of DomainNameService still relevant?
