validation: allow trailing period in dns search

The trailing period tells the resolver to stop immediately instead
of trying recursively. With that said, trailing period should be
acceptable in searches.
This commit is contained in:
zhouhaibing089
2019-02-27 14:16:54 -08:00
committed by haibzhou
parent 7dbe426b24
commit 68beadefe4
2 changed files with 12 additions and 1 deletions

View File

@@ -5873,11 +5873,18 @@ func TestValidatePodDNSConfig(t *testing.T) {
},
expectedError: false,
},
{
desc: "valid: 1 search path with trailing period",
dnsConfig: &core.PodDNSConfig{
Searches: []string{"custom."},
},
expectedError: false,
},
{
desc: "valid: 3 nameservers and 6 search paths",
dnsConfig: &core.PodDNSConfig{
Nameservers: []string{"127.0.0.1", "10.0.0.10", "8.8.8.8"},
Searches: []string{"custom", "mydomain.com", "local", "cluster.local", "svc.cluster.local", "default.svc.cluster.local"},
Searches: []string{"custom", "mydomain.com", "local", "cluster.local", "svc.cluster.local", "default.svc.cluster.local."},
},
expectedError: false,
},