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

Allow configuring of basic authentication #98

Merged
merged 3 commits into from
Nov 24, 2021
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ The following options are supported. See [values.yaml](/charts/atlantis/values.
| `initContainers` | Containers used to initialize context for Atlantis pods | `[]` |
| `extraContainers` | Additionnal containers to use and depends of use cases. | `[]` |
| `hostAliases[].hostnames` | Hostnames for host alias entry | n/a |
| `hostAliases[].ip` | IP for host alias entry | `n/a |
| `hostAliases[].ip` | IP for host alias entry | n/a |
| `basicAuth.username` | Username for basic authentication | n/a |
| `basicAuth.password` | Password for basic authentication | n/a |

**NOTE**: All the [Server Configurations](https://www.runatlantis.io/docs/server-configuration.html) are passed as [Environment Variables](https://www.runatlantis.io/docs/server-configuration.html#environment-variables).

Expand Down
11 changes: 11 additions & 0 deletions charts/atlantis/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,14 @@ Generates AWS Secret name
{{ template "atlantis.fullname" . }}-aws
{{- end -}}
{{- end -}}

{{/*
Generates Basic Auth name
*/}}
{{- define "atlantis.basicAuthSecretName" -}}
{{- if .Values.basicAuthSecretName -}}
{{ .Values.basicAuthSecretName }}
{{- else -}}
{{ template "atlantis.fullname" . }}-basic-auth
{{- end -}}
{{- end -}}
14 changes: 14 additions & 0 deletions charts/atlantis/templates/secret-basic-auth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.basicAuth }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "atlantis.fullname" . }}-basic-auth
labels:
app: {{ template "atlantis.name" . }}
chart: {{ template "atlantis.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
username: {{ .Values.basicAuth.username | b64enc }}
password: {{ .Values.basicAuth.password | b64enc }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/atlantis/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,20 @@ spec:
name: {{ template "atlantis.vcsSecretName" . }}
key: azuredevops_webhook_password
{{- end}}
{{- if .Values.basicAuth }}
- name: ATLANTIS_WEB_BASIC_AUTH
value: "true"
- name: ATLANTIS_WEB_USERNAME
valueFrom:
secretKeyRef:
name: {{ template "atlantis.basicAuthSecretName" . }}
key: username
- name: ATLANTIS_WEB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "atlantis.basicAuthSecretName" . }}
key: password
{{- end}}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
Expand Down
5 changes: 5 additions & 0 deletions charts/atlantis/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ disableRepoLocking: false
# Use Diff Markdown Format for color coding diffs
enableDiffMarkdownFormat: false

# Optionally specify an username and a password for basic authentication
basicAuth:
username: "atlantis"
password: "atlantis"

# We only need to check every 60s since Atlantis is not a high-throughput service.
livenessProbe:
enabled: true
Expand Down