Skip to content

dnsOptions configuration on a pod does not work #1120

Description

@nerdynomadd

What happened?

We were trying to configure the dnsOptions on the pod spec configuration in our deployment but it looks like that the pkg/controllers/resources/pods/translate/translator.go file does not append the parameters passed into pPod.Spec.DNSConfig.Options as it should. It only translates the Nameservers and the Searches parameters:

existingDNSConfig := pPod.Spec.DNSConfig
if existingDNSConfig != nil {
    dnsConfig.Nameservers = deleteDuplicates(append(dnsConfig.Nameservers, existingDNSConfig.Nameservers...))
    dnsConfig.Searches = deleteDuplicates(append(dnsConfig.Searches, existingDNSConfig.Searches...))
}

What did you expect to happen?

We tried to configure the following parameters

dnsConfig:
    options:
        - name: ndtos
           value: 2
        - name: single-request-reopen

& some other parameters such as disabling ipv6 resolution.

But unfortunately this does not work at all

For some reasons we don't want to usednsPolicy: None (as it's suggested on the slack on some messages) because it'll require us to manage the whole configuration on our own and we don't want to deal either with nameserver or with searches, it should rely on the host configuration, not ours

How can we reproduce it (as minimally and precisely as possible)?

Put the dnsConfig above into a pod or a the pod's configuration located into a deployment, it can be a simple busybox, ssh into the container created and execute cat /etc/resolv.conf, the options parameter should be options ndots:5 instead of options ndtos:2

Anything else we need to know?

No response

Host cluster Kubernetes version

Details
$ kubectl version

Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.10", GitCommit:"e770bdbb87cccdc2daa790ecd69f40cf4df3cc9d", GitTreeState:"clean", BuildDate:"2023-05-17T14:12:20Z", GoVersion:"go1.19.9", Compiler:"gc", Platform:"darwin/arm64"}

Kustomize Version: v4.5.7

Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.4", GitCommit:"872a965c6c6526caa949f0c6ac028ef7aff3fb78", GitTreeState:"clean", BuildDate:"2022-11-09T13:29:58Z", GoVersion:"go1.19.3", Compiler:"gc", Platform:"linux/amd64"}

Host cluster Kubernetes distribution

Details
# Write here

vlcuster version

Details
$ vcluster --version

vcluster version 0.15.2

Vcluster Kubernetes distribution(k3s(default)), k8s, k0s)

Details
k8s for prod envs & k3s for preview (development) envs

OS and Arch

Details
OS: 
Arch:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wantedWe encourage community contribution for this issue.kind/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions