Skip to content

Commit 27e1646

Browse files
committed
Allow expanded DNS configuration
Signed-off-by: Gunju Kim <[email protected]>
1 parent 337ede5 commit 27e1646

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

pkg/cri/server/helpers_linux.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ const (
4848
defaultShmSize = int64(1024 * 1024 * 64)
4949
// relativeRootfsPath is the rootfs path relative to bundle path.
5050
relativeRootfsPath = "rootfs"
51-
// According to http://man7.org/linux/man-pages/man5/resolv.conf.5.html:
52-
// "The search list is currently limited to six domains with a total of 256 characters."
53-
maxDNSSearches = 6
5451
// devShm is the default path of /dev/shm.
5552
devShm = "/dev/shm"
5653
// etcHosts is the default path of /etc/hosts file.

pkg/cri/server/sandbox_run_linux.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,6 @@ func (c *criService) setupSandboxFiles(id string, config *runtime.PodSandboxConf
275275
func parseDNSOptions(servers, searches, options []string) (string, error) {
276276
resolvContent := ""
277277

278-
if len(searches) > maxDNSSearches {
279-
return "", errors.Errorf("DNSOption.Searches has more than %d domains", maxDNSSearches)
280-
}
281-
282278
if len(searches) > 0 {
283279
resolvContent += fmt.Sprintf("search %s\n", strings.Join(searches, " "))
284280
}

pkg/cri/server/sandbox_run_linux_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ nameserver server.google.com
394394
options timeout:1
395395
`,
396396
},
397-
"should return error if dns search exceeds limit(6)": {
397+
"expanded dns config should return correct content on modern libc (e.g. glibc 2.26 and above)": {
398+
servers: []string{"8.8.8.8", "server.google.com"},
398399
searches: []string{
399400
"server0.google.com",
400401
"server1.google.com",
@@ -404,7 +405,12 @@ options timeout:1
404405
"server5.google.com",
405406
"server6.google.com",
406407
},
407-
expectErr: true,
408+
options: []string{"timeout:1"},
409+
expectedContent: `search server0.google.com server1.google.com server2.google.com server3.google.com server4.google.com server5.google.com server6.google.com
410+
nameserver 8.8.8.8
411+
nameserver server.google.com
412+
options timeout:1
413+
`,
408414
},
409415
} {
410416
t.Logf("TestCase %q", desc)

0 commit comments

Comments
 (0)