Files
helm-charts-hardened/charts/spire/charts/spire-server/templates/tests/test-connection.yaml
T
kfox1111 96773a310f Bump versions (#777)
* Bump versions

Signed-off-by: Kevin Fox <[email protected]>

* Try this

Signed-off-by: Kevin Fox <[email protected]>

* Fix test for newer spire

Signed-off-by: Kevin Fox <[email protected]>

* Bump controller manager version

Signed-off-by: Kevin Fox <[email protected]>

---------

Signed-off-by: Kevin Fox <[email protected]>
2026-03-29 12:13:59 -07:00

71 lines
2.8 KiB
YAML

{{- if not .Values.externalServer }}
{{ $values := merge .Values }}
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "spire-server.fullname" . }}-test-connection"
namespace: {{ include "spire-server.namespace" . }}
labels:
{{- include "spire-server.labels" . | nindent 4 }}
app.kubernetes.io/component: test
annotations:
"helm.sh/hook": test
spec:
securityContext:
{{- include "spire-lib.podsecuritycontext" . | nindent 4 }}
containers:
- name: curl
image: {{ template "spire-lib.image" (dict "image" .Values.tests.bash.image "global" .Values.global) }}
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 ]; then
if [ $IGNORECA -eq 22 -o $IGNORECA -eq 55 -o $IGNORECA -eq 56 ]; 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
fi
exit 1
securityContext:
{{- include "spire-lib.securitycontext" . | nindent 8 }}
{{- if eq (.Values.federation.enabled | toString) "true" }}
- name: curl-federation-bundle-endpoint
image: {{ template "spire-lib.image" (dict "image" .Values.tests.bash.image "global" .Values.global) }}
command: ['curl']
args: ['-k', '-s', '-f', 'https://{{ include "spire-server.fullname" . }}.{{ include "spire-server.namespace" . }}.svc.{{ include "spire-lib.cluster-domain" . }}:{{ .Values.federation.bundleEndpoint.port }}']
securityContext:
{{- include "spire-lib.securitycontext" . | nindent 8 }}
{{- end }}
{{- if .Values.federation.ingress.enabled }}
- name: federation-ingress
image: {{ template "spire-lib.image" (dict "image" .Values.tests.bash.image "global" .Values.global) }}
command: ['curl']
args:
{{ include "spire-server.test.federation-ingress-args" (dict "Values" $values) | nindent 8 }}
{{- if ne (len (dig "tests" "tls" "customCA" "" $values)) 0 }}
volumeMounts:
- name: custom-ca
mountPath: /ca
{{- end }}
securityContext:
{{- include "spire-lib.securitycontext" . | nindent 8 }}
{{- end }}
{{- if ne (len (dig "tests" "hostAliases" "" $values)) 0 }}
hostAliases:
{{- toYaml .Values.tests.hostAliases | nindent 4 }}
{{- end }}
{{- if ne (len (dig "tests" "tls" "customCA" "" $values)) 0 }}
volumes:
- name: custom-ca
secret:
secretName: {{ .Values.tests.tls.customCA }}
{{- end }}
restartPolicy: Never
{{- end }}