mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #109441 from Miciah/kubelet-parseResolvConf-handle-search-dot
kubelet: parseResolvConf: Handle "search ."
This commit is contained in:
commit
d9fa563550
@ -267,7 +267,10 @@ func parseResolvConf(reader io.Reader) (nameservers []string, searches []string,
|
||||
// Normalise search fields so the same domain with and without trailing dot will only count once, to avoid hitting search validation limits.
|
||||
searches = []string{}
|
||||
for _, s := range fields[1:] {
|
||||
searches = append(searches, strings.TrimSuffix(s, "."))
|
||||
if s != "." {
|
||||
s = strings.TrimSuffix(s, ".")
|
||||
}
|
||||
searches = append(searches, s)
|
||||
}
|
||||
}
|
||||
if fields[0] == "options" {
|
||||
|
@ -78,6 +78,7 @@ func TestParseResolvConf(t *testing.T) {
|
||||
{"nameserver 1.2.3.4\nnameserver 5.6.7.8", []string{"1.2.3.4", "5.6.7.8"}, []string{}, []string{}, false},
|
||||
{"nameserver 1.2.3.4 #comment", []string{"1.2.3.4"}, []string{}, []string{}, false},
|
||||
{"search ", []string{}, []string{}, []string{}, false}, // search empty
|
||||
{"search .", []string{}, []string{"."}, []string{}, false},
|
||||
{"search foo", []string{}, []string{"foo"}, []string{}, false},
|
||||
{"search foo bar", []string{}, []string{"foo", "bar"}, []string{}, false},
|
||||
{"search foo. bar", []string{}, []string{"foo", "bar"}, []string{}, false},
|
||||
|
Loading…
Reference in New Issue
Block a user