Skip to content

Commit

Permalink
allow overriding csrfkey with custom value
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks committed Apr 9, 2024
1 parent 3f286ca commit a409053
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion charts/kubernetes-dashboard/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ app.kubernetes.io/part-of: {{ include "kubernetes-dashboard.name" . }}
{{- define "kubernetes-dashboard.app.csrf.secret.value" -}}
{{- $secretName := (include "kubernetes-dashboard.app.csrf.secret.name" .) -}}
{{- $secret := lookup "v1" "Secret" .Release.Namespace $secretName -}}
{{- if and $secret (hasKey $secret "data") (hasKey $secret.data "private.key") (index $secret.data "private.key") -}}
{{- if .Values.app.security.csrfKey }}
private.key: {{ .Values.app.security.csrfKey | b64enc | quote }}
{{- else if and $secret (hasKey $secret "data") (hasKey $secret.data "private.key") (index $secret.data "private.key") -}}
private.key: {{ index $secret.data "private.key" }}
{{- else -}}
private.key: {{ randBytes 256 | b64enc | quote }}
Expand Down
4 changes: 4 additions & 0 deletions charts/kubernetes-dashboard/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ app:
# Ref: https://kubernetes.io/docs/user-guide/node-selection/
nodeSelector: {}
security:
# Allow overriding csrfKey used by API/Auth containers.
# It has to be base64 encoded random 256 bytes string.
# If empty, it will be autogenerated.
csrfKey: ~
# SecurityContext to be added to pods
# To disable set the following configuration to null:
# securityContext: null
Expand Down

0 comments on commit a409053

Please sign in to comment.