Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to set dnsConfig on pod template #821

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions traefik/templates/_podtemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@
{{- with .Values.deployment.dnsPolicy }}
dnsPolicy: {{ . }}
{{- end }}
{{- with .Values.deployment.dnsConfig }}
dnsConfig:
mloiseleur marked this conversation as resolved.
Show resolved Hide resolved
{{- 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 }}
Expand Down
46 changes: 46 additions & 0 deletions traefik/tests/pod-config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
mloiseleur marked this conversation as resolved.
Show resolved Hide resolved
- 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
mloiseleur marked this conversation as resolved.
Show resolved Hide resolved
- 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:
mloiseleur marked this conversation as resolved.
Show resolved Hide resolved
- 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"
10 changes: 10 additions & 0 deletions traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down