Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Adding basic authentication values in K8s helm chart (#744)
Browse files Browse the repository at this point in the history
* adding basic authentication options to helm chart

* updating README for basic auth

* extra line break in notes

* fixing typo
  • Loading branch information
wlaoh authored and diemol committed Oct 13, 2018
1 parent c69467a commit cbf6536
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
7 changes: 5 additions & 2 deletions docs/k8s/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ See Zalenium's [usage examples](https://github.com/zalando/zalenium/blob/master/
| `hub.sauceAccessKey` | Access key to log into saucelabs | blank |
| `hub.browserStackUser` | Credentials for browserstack | blank |
| `hub.browserStackKey` | Credentials for browserstack | blank |
| `hub.testingBotKey` | Credentials for testingbot | blank |
| `hub.testingBotSecret` | Credentials for testingbot | blank |
| `hub.testingBotKey` | Credentials for testingbot | blank |
| `hub.testingBotSecret` | Credentials for testingbot | blank |
| `hub.basicAuth.enabled` | Enables basic authentication | false |
| `hub.basicAuth.username` | Username for basic authentication | zalenium |
| `hub.basicAuth.password` | Password for basic authentication | password |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

Expand Down
18 changes: 17 additions & 1 deletion docs/k8s/helm/local/zalenium/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
Hi.
###################################################
# Zalenium #
###################################################

Your release is named "{{ .Release.Name }}".

{{- if eq true .Values.hub.basicAuth.enabled }}
Basic Authentication:
Username: {{ .Values.hub.basicAuth.username }}
Password: {{ .Values.hub.basicAuth.password }}
{{- end }}

To learn more about the release, try:

$ helm status {{ .Release.Name }}
$ helm get {{ .Release.Name }}

7 changes: 7 additions & 0 deletions docs/k8s/helm/local/zalenium/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,11 @@ Create the name of the service account
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Create base64 encoded basic authentication for readiness/liveness probe
*/}}
{{- define "basicAuth.b64" -}}
{{- printf "%s:%s" .Values.hub.basicAuth.username .Values.hub.basicAuth.password | b64enc -}}
{{- end -}}
16 changes: 16 additions & 0 deletions docs/k8s/helm/local/zalenium/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,22 @@ spec:
httpGet:
path: /grid/console
port: {{ .Values.hub.port }}
{{- if eq true .Values.hub.basicAuth.enabled }}
httpHeaders:
- name: Authorization
value: Basic {{ template "basicAuth.b64" . }}
{{- end}}
initialDelaySeconds: 90
periodSeconds: 5
readinessProbe:
httpGet:
path: /grid/console
port: {{ .Values.hub.port }}
{{- if eq true .Values.hub.basicAuth.enabled }}
httpHeaders:
- name: Authorization
value: Basic {{ template "basicAuth.b64" . }}
{{- end}}
timeoutSeconds: {{ .Values.hub.readinessTimeout }}
env:
- name: ZALENIUM_KUBERNETES_CPU_REQUEST
Expand Down Expand Up @@ -127,6 +137,12 @@ spec:
- '{{ .Values.hub.keepOnlyFailedTests }}'
- '--retentionPeriod'
- '{{ .Values.hub.retentionPeriod }}'
{{- if eq true .Values.hub.basicAuth.enabled }}
- '--gridUser'
- '{{ .Values.hub.basicAuth.username }}'
- '--gridPassword'
- '{{ .Values.hub.basicAuth.password }}'
{{- end }}
resources:
{{ toYaml .Values.hub.resources | indent 12 }}
volumeMounts:
Expand Down
4 changes: 4 additions & 0 deletions docs/k8s/helm/local/zalenium/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ hub:
keepOnlyFailedTests: false
retentionPeriod: 3
sendAnonymousUsageInfo: true
basicAuth:
enabled: false
username: "zalenium"
password: "password"

# Environment variables passed to Zalenium hub.
sauceUserName: blank
Expand Down

0 comments on commit cbf6536

Please sign in to comment.