-
Notifications
You must be signed in to change notification settings - Fork 57
feat(charts/authentik): Support Service accounts for authentik #321
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
base: main
Are you sure you want to change the base?
Conversation
This will allow the use of container secret intrfaces
rissson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already support setting a custom service account. As such I'm not inclined to accept this PR.
| {{- if .Values.server.serviceAccount.create }} | ||
| {{- if .Values.server.serviceAccount.name }} | ||
| serviceAccountName: {{ .Values.server.serviceAccount.name }} | ||
| {{- else }} | ||
| serviceAccountName: {{ template "authentik.server.fullname" . }} | ||
| {{- end }} | ||
| {{- else }} | ||
| {{- with .Values.server.imagePullSecrets | default .Values.global.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- with .Values.server.serviceAccountName }} | ||
| serviceAccountName: {{ . }} | ||
| {{- end }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might result in multiple serviceAccountName being set. Also, it removes imagePullSecrets when no service account is set
| {{- if .Values.worker.serviceAccount.create }} | ||
| {{- if .Values.worker.serviceAccount.name }} | ||
| serviceAccountName: {{ .Values.worker.serviceAccount.name }} | ||
| {{- else }} | ||
| serviceAccountName: {{ template "authentik.server.fullname" . }} | ||
| {{- end }} | ||
| {{- else }} | ||
| {{- with .Values.worker.imagePullSecrets | default .Values.global.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| {{- with .Values.worker.serviceAccountName }} | ||
| {{- end }} | ||
| {{- with .Values.server.serviceAccountName }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the server. Also this references server.serviceAccountName although we're templating the worker deployment here
| serviceAccountName: ~ | ||
|
|
||
| serviceAccount: | ||
| create: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely shouldn't be true by default, especially since we're using authentik-remote-cluster by default.
wrenix
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is really hard to read that code.
| {{- if .Values.server.serviceAccount.name }} | ||
| serviceAccountName: {{ .Values.server.serviceAccount.name }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with is a implizit if -> make that code more readable
| {{- if .Values.server.serviceAccount.name }} | |
| serviceAccountName: {{ .Values.server.serviceAccount.name }} | |
| {{- with .Values.server.serviceAccount.name }} | |
| serviceAccountName: {{ . }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or better see worker: #321 (comment)
| {{- if .Values.server.serviceAccount.annotations }} | ||
| annotations: | ||
| {{ toYaml .Values.serviceAccount.annotations | indent 4 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {{- if .Values.server.serviceAccount.annotations }} | |
| annotations: | |
| {{ toYaml .Values.serviceAccount.annotations | indent 4 }} | |
| {{- end }} | |
| {{- with .Values.server.serviceAccount.annotations }} | |
| annotations: | |
| {{- toYaml . | nindent 4 }} | |
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with is a implizit if -> make that code more readable
| {{- if .Values.server.serviceAccount.labels }} | ||
| {{- toYaml .Values.server.serviceAccount.labels | nindent 4 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {{- if .Values.server.serviceAccount.labels }} | |
| {{- toYaml .Values.server.serviceAccount.labels | nindent 4 }} | |
| {{- end }} | |
| {{- with .Values.server.serviceAccount.labels }} | |
| {{- toYaml . | nindent 4 }} | |
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with is a implizit if -> make that code more readable
| {{- with (mergeOverwrite (deepCopy .Values.global.podLabels) .Values.worker.podLabels) }} | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| {{- if .Values.worker.serviceAccount.labels }} | ||
| {{- toYaml .Values.worker.serviceAccount.labels | nindent 4 }} | ||
| {{- end }} | ||
| {{- if .Values.worker.serviceAccount.annotations }} | ||
| annotations: | ||
| {{ toYaml .Values.serviceAccount.annotations | indent 4 }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be more consequent with spaces, {{- vs. {{, if vs. with and nindent vs. indent.
| {{- with (mergeOverwrite (deepCopy .Values.global.podLabels) .Values.worker.podLabels) }} | |
| {{- toYaml . | nindent 4 }} | |
| {{- end }} | |
| {{- if .Values.worker.serviceAccount.labels }} | |
| {{- toYaml .Values.worker.serviceAccount.labels | nindent 4 }} | |
| {{- end }} | |
| {{- if .Values.worker.serviceAccount.annotations }} | |
| annotations: | |
| {{ toYaml .Values.serviceAccount.annotations | indent 4 }} | |
| {{- end }} | |
| {{- with (mergeOverwrite (dict) .Values.global.podLabels) .Values.worker.podLabels) }} | |
| {{- toYaml . | nindent 4 }} | |
| {{- end }} | |
| {{- with .Values.worker.serviceAccount.labels }} | |
| {{- toYaml . | nindent 4 }} | |
| {{- end }} | |
| {{- with .Values.worker.serviceAccount.annotations }} | |
| annotations: | |
| {{- toYaml . | nindent 4 }} | |
| {{- end }} |
| {{- if .Values.worker.serviceAccount.name }} | ||
| name: {{ .Values.worker.serviceAccount.name }} | ||
| {{- else }} | ||
| name: {{ template "authentik.server.fullname" . }} | ||
| {{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or us with instatt of if
| {{- if .Values.worker.serviceAccount.name }} | |
| name: {{ .Values.worker.serviceAccount.name }} | |
| {{- else }} | |
| name: {{ template "authentik.server.fullname" . }} | |
| {{- end }} | |
| name: {{ .Values.worker.serviceAccount.name | default (template "authentik.server.fullname" .) }} |
This will allow the use of container secret intrfaces