Skip to content

Commit a5bb353

Browse files
Epicsteve2hashhar
authored andcommitted
Add service account
1 parent aaea597 commit a5bb353

File tree

6 files changed

+57
-0
lines changed

6 files changed

+57
-0
lines changed

charts/trino/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ The following table lists the configurable parameters of the Trino chart and the
4848
| `nodeSelector` | | `{}` |
4949
| `tolerations` | | `[]` |
5050
| `affinity` | | `{}` |
51+
| `serviceAccount.create` | | `false` |
52+
| `serviceAccount.name` | | `""` |
53+
| `serviceAccount.annotations` | | `{}` |
5154

5255

5356

charts/trino/templates/_helpers.tpl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,34 @@ Create chart name and version as used by the chart label.
6161
{{- define "trino.catalog" -}}
6262
{{ template "trino.fullname" . }}-catalog
6363
{{- end -}}
64+
65+
{{/*
66+
Common labels
67+
*/}}
68+
{{- define "trino.labels" -}}
69+
helm.sh/chart: {{ include "trino.chart" . }}
70+
{{ include "trino.selectorLabels" . }}
71+
{{- if .Chart.AppVersion }}
72+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
73+
{{- end }}
74+
app.kubernetes.io/managed-by: {{ .Release.Service }}
75+
{{- end }}
76+
77+
{{/*
78+
Selector labels
79+
*/}}
80+
{{- define "trino.selectorLabels" -}}
81+
app.kubernetes.io/name: {{ include "trino.name" . }}
82+
app.kubernetes.io/instance: {{ .Release.Name }}
83+
{{- end }}
84+
85+
{{/*
86+
Create the name of the service account to use
87+
*/}}
88+
{{- define "trino.serviceAccountName" -}}
89+
{{- if .Values.serviceAccount.create }}
90+
{{- default (include "trino.fullname" .) .Values.serviceAccount.name }}
91+
{{- else }}
92+
{{- default "default" .Values.serviceAccount.name }}
93+
{{- end }}
94+
{{- end }}

charts/trino/templates/deployment-coordinator.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ spec:
2121
release: {{ .Release.Name }}
2222
component: coordinator
2323
spec:
24+
serviceAccountName: {{ include "trino.serviceAccountName" . }}
2425
{{- with .Values.securityContext }}
2526
securityContext:
2627
runAsUser: {{ .runAsUser }}

charts/trino/templates/deployment-worker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ spec:
2323
release: {{ .Release.Name }}
2424
component: worker
2525
spec:
26+
serviceAccountName: {{ include "trino.serviceAccountName" . }}
2627
volumes:
2728
- name: config-volume
2829
configMap:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "trino.serviceAccountName" . }}
6+
labels:
7+
{{- include "trino.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- end }}

charts/trino/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,12 @@ nodeSelector: {}
9191
tolerations: []
9292

9393
affinity: {}
94+
95+
serviceAccount:
96+
# Specifies whether a service account should be created
97+
create: false
98+
# The name of the service account to use.
99+
# If not set and create is true, a name is generated using the fullname template
100+
name: ""
101+
# Annotations to add to the service account
102+
annotations: {}

0 commit comments

Comments
 (0)