Skip to content

Commit

Permalink
feat: add dnsConfig to Atlantis (runatlantis#397)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored Jun 18, 2024
1 parent 4b2c4e1 commit 7b0c398
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/atlantis/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
appVersion: v0.28.1
description: A Helm chart for Atlantis https://www.runatlantis.io
name: atlantis
version: 5.1.3
version: 5.2.0
keywords:
- terraform
home: https://www.runatlantis.io
Expand Down
2 changes: 2 additions & 0 deletions charts/atlantis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ extraManifests:
| disableApply | bool | `false` | Disables running `atlantis apply` regardless of which flags are sent with it. |
| disableApplyAll | bool | `false` | Disables running `atlantis apply` without any flags. |
| disableRepoLocking | bool | `false` | Stops atlantis locking projects and or workspaces when running terraform. |
| dnsConfig | object | `{}` | Optionally specify dnsConfig for the Atlantis pod. Check values.yaml for examples. |
| 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 |
| enableDiffMarkdownFormat | bool | `false` | Use Diff Markdown Format for color coding diffs. |
| enableKubernetesBackend | bool | `false` | Optionally deploy rbac to allow for the serviceAccount to manage terraform state via the kubernetes backend. |
| environment | object | `{}` | Environtment values to add to the Atlantis pod. Check values.yaml for examples. |
Expand Down
19 changes: 19 additions & 0 deletions charts/atlantis/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ spec:
{{- toYaml .Values.podTemplate.annotations | nindent 8 }}
{{- end }}
spec:
{{- if and (or .Values.dnsPolicy (.Values.dnsPolicy and .Values.dnsConfig)) (ne .Values.dnsPolicy "ClusterFirst") }}
dnsPolicy: {{ .Values.dnsPolicy}}
{{- end }}
{{- if or .Values.dnsConfig (eq .Values.dnsPolicy "None") }}
{{- if not .Values.dnsConfig }}
{{- fail "dnsPolicy is set to 'None', but dnsConfig is not provided" }}
{{- end }}
dnsConfig:
nameservers:
{{- range .Values.dnsConfig.nameservers }}
- {{ . }}
{{- end }}
{{- if .Values.dnsConfig.searches }}
searches:
{{- range .Values.dnsConfig.searches }}
- {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.hostAliases }}
hostAliases:
{{- range .Values.hostAliases }}
Expand Down
53 changes: 52 additions & 1 deletion charts/atlantis/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@
"type": [
"integer",
"null"
],
],
"description": "Set terminationGracePeriodSeconds for the StatefulSet."
},
"ingress": {
Expand Down Expand Up @@ -1050,6 +1050,39 @@
}
]
},
"dnsPolicy": {
"type": "string",
"default": "ClusterFirst",
"description": "dnsPolicy for Atlantis pods",
"enum": [
"ClusterFirst",
"Default",
"ClusterFirstWithHostNet",
"None"
],
"examples": [
"ClusterFirst",
"Default",
"ClusterFirstWithHostNet",
"None"
]
},
"dnsConfig": {
"description": "Specify dnsConfig for Atlantis containers.",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.DnsConfig"
},
"type": "object",
"default": [],
"examples": [
{
"nameservers": "8.8.8.8",
"searches": [
"mydomain.com"
]
}
]
},
"hostNetwork": {
"type": "boolean",
"description": "Use the host's network namespace.",
Expand Down Expand Up @@ -1232,6 +1265,24 @@
"type": "object",
"additionalProperties": false
},
"io.k8s.api.core.v1.DnsConfig": {
"description": "DnsConfig ",
"properties": {
"nameservers": {
"description": "a list of IP addresses that will be used as DNS servers for the search domain.",
"items": {
"type": "string"
},
"type": "array"
},
"searches": {
"description": "A list of DNS search domains for hostname lookup.",
"type": "string"
}
},
"type": "object",
"additionalProperties": false
},
"io.k8s.api.core.v1.Container": {
"description": "A single application container that you want to run within a pod.",
"properties": {
Expand Down
13 changes: 13 additions & 0 deletions charts/atlantis/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,19 @@ hostAliases: []
# - bbb.com
# ip: 10.0.0.2

# -- 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
dnsPolicy: "ClusterFirst"

# -- Optionally specify dnsConfig for the Atlantis pod.
# Check values.yaml for examples.
dnsConfig: {}
# dnsConfig:
# nameservers:
# - 8.8.8.8
# searches:
# - mydomain.com

hostNetwork: false

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

0 comments on commit 7b0c398

Please sign in to comment.