Skip to content

Commit

Permalink
Add service account
Browse files Browse the repository at this point in the history
  • Loading branch information
Epicsteve2 authored and hashhar committed Mar 3, 2022
1 parent aaea597 commit a5bb353
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/trino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ The following table lists the configurable parameters of the Trino chart and the
| `nodeSelector` | | `{}` |
| `tolerations` | | `[]` |
| `affinity` | | `{}` |
| `serviceAccount.create` | | `false` |
| `serviceAccount.name` | | `""` |
| `serviceAccount.annotations` | | `{}` |



Expand Down
31 changes: 31 additions & 0 deletions charts/trino/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,34 @@ Create chart name and version as used by the chart label.
{{- define "trino.catalog" -}}
{{ template "trino.fullname" . }}-catalog
{{- end -}}

{{/*
Common labels
*/}}
{{- define "trino.labels" -}}
helm.sh/chart: {{ include "trino.chart" . }}
{{ include "trino.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "trino.selectorLabels" -}}
app.kubernetes.io/name: {{ include "trino.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "trino.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "trino.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions charts/trino/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ spec:
release: {{ .Release.Name }}
component: coordinator
spec:
serviceAccountName: {{ include "trino.serviceAccountName" . }}
{{- with .Values.securityContext }}
securityContext:
runAsUser: {{ .runAsUser }}
Expand Down
1 change: 1 addition & 0 deletions charts/trino/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ spec:
release: {{ .Release.Name }}
component: worker
spec:
serviceAccountName: {{ include "trino.serviceAccountName" . }}
volumes:
- name: config-volume
configMap:
Expand Down
12 changes: 12 additions & 0 deletions charts/trino/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "trino.serviceAccountName" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/trino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,12 @@ nodeSelector: {}
tolerations: []

affinity: {}

serviceAccount:
# Specifies whether a service account should be created
create: false
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
# Annotations to add to the service account
annotations: {}

0 comments on commit a5bb353

Please sign in to comment.