diff --git a/traefik/templates/_podtemplate.tpl b/traefik/templates/_podtemplate.tpl index 8b54a1dc0..bfb83f14e 100644 --- a/traefik/templates/_podtemplate.tpl +++ b/traefik/templates/_podtemplate.tpl @@ -27,6 +27,21 @@ {{- with .Values.deployment.dnsPolicy }} dnsPolicy: {{ . }} {{- end }} + {{- with .Values.deployment.dnsConfig }} + dnsConfig: + {{- if .searches }} + searches: + {{- toYaml .searches | nindent 10 }} + {{- end }} + {{- if .nameservers }} + nameservers: + {{- toYaml .nameservers | nindent 10 }} + {{- end }} + {{- if .options }} + options: + {{- toYaml .options | nindent 10 }} + {{- end }} + {{- end }} {{- with .Values.deployment.initContainers }} initContainers: {{- toYaml . | nindent 6 }} diff --git a/traefik/tests/pod-config_test.yaml b/traefik/tests/pod-config_test.yaml index 37f25345f..df2e7e73c 100644 --- a/traefik/tests/pod-config_test.yaml +++ b/traefik/tests/pod-config_test.yaml @@ -523,3 +523,49 @@ tests: hostPort: 1234 name: websecure-http3 protocol: UDP + - it: should have a custom list of dns nameservers + set: + deployment: + dnsConfig: + nameservers: + - 1.1.1.1 + - 2001:db8:30::a + asserts: + - equal: + path: spec.template.spec.dnsConfig.nameservers[0] + value: "1.1.1.1" + - equal: + path: spec.template.spec.dnsConfig.nameservers[1] + value: "2001:db8:30::a" + - it: should have a list of dns search domain + set: + deployment: + dnsConfig: + searches: + - ns1.svc.cluster-domain.example + - my.dns.search.suffix + asserts: + - equal: + path: spec.template.spec.dnsConfig.searches[0] + value: "ns1.svc.cluster-domain.example" + - equal: + path: spec.template.spec.dnsConfig.searches[1] + value: "my.dns.search.suffix" + - it: should have a custom dns options + set: + deployment: + dnsConfig: + options: + - name: ndots + value: 2 + - name: edns0 + asserts: + - equal: + path: spec.template.spec.dnsConfig.options[0].name + value: "ndots" + - equal: + path: spec.template.spec.dnsConfig.options[0].value + value: 2 + - equal: + path: spec.template.spec.dnsConfig.options[1].name + value: "edns0" diff --git a/traefik/values.yaml b/traefik/values.yaml index 9ece30301..fe9dd92bd 100644 --- a/traefik/values.yaml +++ b/traefik/values.yaml @@ -82,6 +82,16 @@ deployment: shareProcessNamespace: false # Custom pod DNS policy. Apply if `hostNetwork: true` # dnsPolicy: ClusterFirstWithHostNet + dnsConfig: {} + # nameservers: + # - 192.0.2.1 # this is an example + # searches: + # - ns1.svc.cluster-domain.example + # - my.dns.search.suffix + # options: + # - name: ndots + # value: "2" + # - name: edns0 # Additional imagePullSecrets imagePullSecrets: [] # - name: myRegistryKeySecretName