Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to create a service account and specify a default user id in securityContext #815

Merged
merged 3 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helm/akhq/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.18.0"
description: Kafka GUI for Apache Kafka to manage topics, topics data, consumers group, schema registry, connect and more...
name: akhq
version: 0.2.2
version: 0.2.3
keywords:
- kafka
- confluent
Expand Down
11 changes: 11 additions & 0 deletions helm/akhq/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@ Create chart name and version as used by the chart label.
{{- define "akhq.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "akhq.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "akhq.fullname" .) .Values.serviceAccountName }}
{{- else }}
{{- default "default" .Values.serviceAccountName }}
{{- end }}
{{- end }}
4 changes: 1 addition & 3 deletions helm/akhq/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ spec:
securityContext:
{{ toYaml .Values.securityContext | nindent 8 }}
{{- end }}
{{- if .Values.serviceAccountName }}
serviceAccountName: {{ .Values.serviceAccountName }}
{{- end }}
serviceAccountName: {{ include "akhq.serviceAccountName" . }}
{{- if .Values.initContainers }}
initContainers:
{{- range $key, $value := .Values.initContainers }}
Expand Down
15 changes: 15 additions & 0 deletions helm/akhq/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: {{ include "akhq.name" . }}
helm.sh/chart: {{ include "akhq.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
name: {{ include "akhq.serviceAccountName" . }}
{{- end }}
10 changes: 8 additions & 2 deletions helm/akhq/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ extraVolumeMounts: []

# Specify ServiceAccount for pod
serviceAccountName: null
serviceAccount:
create: false
#annotations:
# eks.amazonaws.com/role-arn: arn:aws:iam::123456789000:role/iam-role-name-here

# Add your own init container or uncomment and modify the example.
initContainers: {}
Expand All @@ -73,13 +77,15 @@ initContainers: {}
# - mountPath: /tmp
# name: certs

securityContext: {}
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsUser: 1000
# capabilities:
# drop:
# - ALL
# # readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
enabled: true
Expand Down