Commit df22c6ab authored by Sandro Mathys's avatar Sandro Mathys
Browse files

make helm tests configurable

parent 832edac4
...@@ -42,3 +42,15 @@ frontend: ...@@ -42,3 +42,15 @@ frontend:
accessRules: | accessRules: |
Require shib-attr homeOrganization switch.ch Require shib-attr homeOrganization switch.ch
tests:
enabled: true
imagePullSecrets:
# personal(!) access token with read AND write privileges to the registry in order to use the dependency proxy
- name: shibboleth-sp-dependency-proxy
image:
repository: "gitlab.switch.ch/helm-charts/shibboleth-sp/dependency_proxy/containers/curlimages/curl"
tag: "latest"
pullPolicy: "Always"
...@@ -148,6 +148,13 @@ Create the names of the images and pull policies to use ...@@ -148,6 +148,13 @@ Create the names of the images and pull policies to use
{{- .Values.backend.shibboleth.sessionCache.sealerKeys.image.pullPolicy | default (include "shibboleth-sp.backend.imagePullPolicy" .) }} {{- .Values.backend.shibboleth.sessionCache.sealerKeys.image.pullPolicy | default (include "shibboleth-sp.backend.imagePullPolicy" .) }}
{{- end }} {{- end }}
{{- define "shibboleth-sp.tests.image" -}}
{{- printf "%s:%s" .Values.tests.image.repository .Values.tests.image.tag }}
{{- end }}
{{- define "shibboleth-sp.tests.imagePullPolicy" -}}
{{- .Values.tests.image.pullPolicy }}
{{- end }}
{{/* {{/*
Create the names of the secrets to use Create the names of the secrets to use
*/}} */}}
......
{{- if .Values.tests.enabled }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: {{ include "shibboleth-sp.name" . }}-helm-test-curl name: {{ include "shibboleth-sp.fullname" . }}-helm-test-curl
annotations: annotations:
"helm.sh/hook": test "helm.sh/hook": test
spec: spec:
{{- if .Values.tests.imagePullSecrets }}
imagePullSecrets: imagePullSecrets:
# personal(!) access token with read AND write privileges to the registry in order to use the dependency proxy {{- with .Values.tests.imagePullSecrets }}
- name: shibboleth-sp-dependency-proxy {{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
containers: containers:
# check apache is responding # check apache is responding
- name: root - name: root
image: "gitlab.switch.ch/helm-charts/shibboleth-sp/dependency_proxy/containers/curlimages/curl:7.75.0" image: "{{ include "shibboleth-sp.tests.image" . }}"
imagePullPolicy: "{{ include "shibboleth-sp.tests.imagePullPolicy" . }}"
command: command:
- "sh" - "sh"
- "-c" - "-c"
...@@ -27,7 +32,8 @@ spec: ...@@ -27,7 +32,8 @@ spec:
grep "Location: https://wayf.switch.ch/SWITCHaai/WAYF" /tmp/header.out grep "Location: https://wayf.switch.ch/SWITCHaai/WAYF" /tmp/header.out
# check shibboleth is responding # check shibboleth is responding
- name: session - name: session
image: "gitlab.switch.ch/helm-charts/shibboleth-sp/dependency_proxy/containers/curlimages/curl:7.75.0" image: "{{ include "shibboleth-sp.tests.image" . }}"
imagePullPolicy: "{{ include "shibboleth-sp.tests.imagePullPolicy" . }}"
command: command:
- "sh" - "sh"
- "-c" - "-c"
...@@ -41,3 +47,4 @@ spec: ...@@ -41,3 +47,4 @@ spec:
grep "200 OK" /tmp/header.out grep "200 OK" /tmp/header.out
grep "A valid session was not found." /tmp/document.out grep "A valid session was not found." /tmp/document.out
restartPolicy: Never restartPolicy: Never
{{- end -}}
...@@ -321,3 +321,16 @@ frontend: ...@@ -321,3 +321,16 @@ frontend:
proxyPreserveHost: "" # default: "off" proxyPreserveHost: "" # default: "off"
remoteURL: "" # must be absolute (i.e. starting with http:// or https://) remoteURL: "" # must be absolute (i.e. starting with http:// or https://)
accessRules: "" accessRules: ""
# helm tests
tests:
enabled: false
# imagePullSecrets:
# - name:
# requires sh, echo, cat, curl, grep in the path of the image
image:
repository: "docker.io/curlimages/curl"
tag: "latest"
pullPolicy: "IfNotPresent"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment