Files
helm-charts-hardened/charts/spire/charts/spire-server/templates/tests/test-connection.yaml
T
kfox1111andMarco Franssen c661d0bc7e Make service dns domain configurable (#164)
Co-authored-by: Marco Franssen <[email protected]>
Signed-off-by: Marco Franssen <[email protected]>
2023-04-03 19:52:36 +02:00

41 lines
1.6 KiB
YAML

apiVersion: v1
kind: Pod
metadata:
name: "{{ include "spire-server.fullname" . }}-test-connection"
namespace: {{ include "spire-server.namespace" . }}
labels:
{{- include "spire-server.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 4 }}
containers:
- name: curl
image: cgr.dev/chainguard/bash:latest
command: ['bash']
args:
- -c
- |
curl -f -s 'https://{{ include "spire-server.fullname" . }}:{{ .Values.service.port }}'
NOCA=$?
curl -k -f -s 'https://{{ include "spire-server.fullname" . }}:{{ .Values.service.port }}'
IGNORECA=$?
echo $NOCA $IGNORECA
if [ $NOCA -eq 60 -a $IGNORECA -eq 22 ]; then
# We were able to connect to the server but didn't recognize the ca (60) and the page not found (22) because we're not using grpc
exit 0
fi
exit 1
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
{{- if eq (.Values.federation.enabled | toString) "true" }}
- name: curl-federation-bundle-endpoint
image: cgr.dev/chainguard/bash:latest
command: ['curl']
args: ['-k', '-s', '-f', 'https://{{ include "spire-server.fullname" . }}.{{ include "spire-server.namespace" . }}.svc.{{ include "spire-server.cluster-domain" . }}:{{ .Values.federation.bundleEndpoint.port }}']
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
{{- end }}
restartPolicy: Never