Skip to content

Commit 7b0c398

Browse files
sirpalmeiraoAlvaro PalmeiraoGMartinez-Sisti
authored
feat: add dnsConfig to Atlantis (#397)
* feat: add dnsConfig to Atlantis --------- Co-authored-by: Alvaro Palmeirao <alvaro.palmeirao@five9.com> Co-authored-by: Gabriel Martinez <19713226+GMartinez-Sisti@users.noreply.github.com>
1 parent 4b2c4e1 commit 7b0c398

5 files changed

Lines changed: 87 additions & 2 deletions

File tree

charts/atlantis/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: v1
33
appVersion: v0.28.1
44
description: A Helm chart for Atlantis https://www.runatlantis.io
55
name: atlantis
6-
version: 5.1.3
6+
version: 5.2.0
77
keywords:
88
- terraform
99
home: https://www.runatlantis.io

charts/atlantis/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ extraManifests:
9494
| disableApply | bool | `false` | Disables running `atlantis apply` regardless of which flags are sent with it. |
9595
| disableApplyAll | bool | `false` | Disables running `atlantis apply` without any flags. |
9696
| disableRepoLocking | bool | `false` | Stops atlantis locking projects and or workspaces when running terraform. |
97+
| dnsConfig | object | `{}` | Optionally specify dnsConfig for the Atlantis pod. Check values.yaml for examples. |
98+
| dnsPolicy | string | `"ClusterFirst"` | Optionally specify dnsPolicy parameter to specify a DNS policy for a pod Check https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy |
9799
| enableDiffMarkdownFormat | bool | `false` | Use Diff Markdown Format for color coding diffs. |
98100
| enableKubernetesBackend | bool | `false` | Optionally deploy rbac to allow for the serviceAccount to manage terraform state via the kubernetes backend. |
99101
| environment | object | `{}` | Environtment values to add to the Atlantis pod. Check values.yaml for examples. |

charts/atlantis/templates/statefulset.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,25 @@ spec:
4141
{{- toYaml .Values.podTemplate.annotations | nindent 8 }}
4242
{{- end }}
4343
spec:
44+
{{- if and (or .Values.dnsPolicy (.Values.dnsPolicy and .Values.dnsConfig)) (ne .Values.dnsPolicy "ClusterFirst") }}
45+
dnsPolicy: {{ .Values.dnsPolicy}}
46+
{{- end }}
47+
{{- if or .Values.dnsConfig (eq .Values.dnsPolicy "None") }}
48+
{{- if not .Values.dnsConfig }}
49+
{{- fail "dnsPolicy is set to 'None', but dnsConfig is not provided" }}
50+
{{- end }}
51+
dnsConfig:
52+
nameservers:
53+
{{- range .Values.dnsConfig.nameservers }}
54+
- {{ . }}
55+
{{- end }}
56+
{{- if .Values.dnsConfig.searches }}
57+
searches:
58+
{{- range .Values.dnsConfig.searches }}
59+
- {{ . }}
60+
{{- end }}
61+
{{- end }}
62+
{{- end }}
4463
{{- if .Values.hostAliases }}
4564
hostAliases:
4665
{{- range .Values.hostAliases }}

charts/atlantis/values.schema.json

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@
584584
"type": [
585585
"integer",
586586
"null"
587-
],
587+
],
588588
"description": "Set terminationGracePeriodSeconds for the StatefulSet."
589589
},
590590
"ingress": {
@@ -1050,6 +1050,39 @@
10501050
}
10511051
]
10521052
},
1053+
"dnsPolicy": {
1054+
"type": "string",
1055+
"default": "ClusterFirst",
1056+
"description": "dnsPolicy for Atlantis pods",
1057+
"enum": [
1058+
"ClusterFirst",
1059+
"Default",
1060+
"ClusterFirstWithHostNet",
1061+
"None"
1062+
],
1063+
"examples": [
1064+
"ClusterFirst",
1065+
"Default",
1066+
"ClusterFirstWithHostNet",
1067+
"None"
1068+
]
1069+
},
1070+
"dnsConfig": {
1071+
"description": "Specify dnsConfig for Atlantis containers.",
1072+
"items": {
1073+
"$ref": "#/definitions/io.k8s.api.core.v1.DnsConfig"
1074+
},
1075+
"type": "object",
1076+
"default": [],
1077+
"examples": [
1078+
{
1079+
"nameservers": "8.8.8.8",
1080+
"searches": [
1081+
"mydomain.com"
1082+
]
1083+
}
1084+
]
1085+
},
10531086
"hostNetwork": {
10541087
"type": "boolean",
10551088
"description": "Use the host's network namespace.",
@@ -1232,6 +1265,24 @@
12321265
"type": "object",
12331266
"additionalProperties": false
12341267
},
1268+
"io.k8s.api.core.v1.DnsConfig": {
1269+
"description": "DnsConfig ",
1270+
"properties": {
1271+
"nameservers": {
1272+
"description": "a list of IP addresses that will be used as DNS servers for the search domain.",
1273+
"items": {
1274+
"type": "string"
1275+
},
1276+
"type": "array"
1277+
},
1278+
"searches": {
1279+
"description": "A list of DNS search domains for hostname lookup.",
1280+
"type": "string"
1281+
}
1282+
},
1283+
"type": "object",
1284+
"additionalProperties": false
1285+
},
12351286
"io.k8s.api.core.v1.Container": {
12361287
"description": "A single application container that you want to run within a pod.",
12371288
"properties": {

charts/atlantis/values.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,19 @@ hostAliases: []
608608
# - bbb.com
609609
# ip: 10.0.0.2
610610

611+
# -- Optionally specify dnsPolicy parameter to specify a DNS policy for a pod
612+
# Check https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy
613+
dnsPolicy: "ClusterFirst"
614+
615+
# -- Optionally specify dnsConfig for the Atlantis pod.
616+
# Check values.yaml for examples.
617+
dnsConfig: {}
618+
# dnsConfig:
619+
# nameservers:
620+
# - 8.8.8.8
621+
# searches:
622+
# - mydomain.com
623+
611624
hostNetwork: false
612625

613626
# - These annotations will be added to all the resources.

0 commit comments

Comments
 (0)