Skip to content
Snippets Groups Projects
Commit f0942a41 authored by Martin's avatar Martin
Browse files

OZG-7121 add service account

parent 6c7376fa
No related branches found
No related tags found
1 merge request!3Resolve "xta-test-server helm-chart mit Deployment und Keystore-Secrets/Certificate-Resources"
Pipeline #1152 failed
...@@ -70,7 +70,7 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} ...@@ -70,7 +70,7 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- required "baseUrl muss angegeben sein" .Values.baseUrl }} {{- required "baseUrl muss angegeben sein" .Values.baseUrl }}
{{- end -}} {{- end -}}
{{- define "app.serviceAccountName" -}} {{- define "app.getServiceAccountName" -}}
{{ printf "%s" ( (.Values.serviceAccount).name | default "xta-test-server-service-account" ) }} {{ printf "%s" ( (.Values.serviceAccount).name | default "xta-test-server-service-account" ) }}
{{- end -}} {{- end -}}
......
...@@ -48,7 +48,7 @@ spec: ...@@ -48,7 +48,7 @@ spec:
component: xta-test-server component: xta-test-server
spec: spec:
{{- if (.Values.serviceAccount).create }} {{- if (.Values.serviceAccount).create }}
serviceAccountName: {{ include "app.serviceAccountName" . }} serviceAccountName: {{ include "app.getServiceAccountName" . }}
{{- end }} {{- end }}
topologySpreadConstraints: topologySpreadConstraints:
- maxSkew: 1 - maxSkew: 1
......
{{- if (.Values.serviceAccount).create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "app.getServiceAccountName" . }}
namespace: {{ include "app.namespace" . }}
{{- end }}
\ No newline at end of file
suite: service account test
release:
name: xta-test-server
namespace: helm-test
templates:
- templates/service_account.yaml
tests:
- it: should create service account with default name
set:
serviceAccount:
create: true
asserts:
- isKind:
of: ServiceAccount
- isAPIVersion:
of: v1
- equal:
path: metadata.name
value: xta-test-server-service-account
- equal:
path: metadata.namespace
value: helm-test
- it: should create service account with name
set:
serviceAccount:
create: true
name: helm-service-account
asserts:
- isKind:
of: ServiceAccount
- equal:
path: metadata.name
value: helm-service-account
- equal:
path: metadata.namespace
value: helm-test
- it: should not create service account
asserts:
- hasDocuments:
count: 0
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment