generated from PrivateAIM/typescript-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(helm): add secret parsing and helpers to helm chart build_image
- Loading branch information
Showing
4 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{/* | ||
Return the secret containing the Keycloak client secret | ||
*/}} | ||
{{- define "ui.keycloak.secretName" -}} | ||
{{- $secretName := .Values.idp.existingSecret -}} | ||
{{- if and $secretName ( not .Values.idp.debug ) -}} | ||
{{- printf "%s" (tpl $secretName $) -}} | ||
{{- else -}} | ||
{{- printf "%s-node-ui-keycloak-secret" .Release.Name -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the secret key that contains the Keycloak client secret | ||
*/}} | ||
{{- define "ui.keycloak.secretKey" -}} | ||
{{- $secretName := .Values.idp.existingSecret -}} | ||
{{- if .Values.idp.debug -}} | ||
{{- print "nodeUiClientSecret" -}} | ||
{{- else if and $secretName .Values.idp.existingSecretKey -}} | ||
{{- printf "%s" .Values.idp.existingSecretKey -}} | ||
{{- else -}} | ||
{{- print "nodeUiClientSecret" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Generate a random clientSecret value for the node-ui client in keycloak if none provided | ||
*/}} | ||
{{- define "ui.keycloak.clientSecret" -}} | ||
{{- if .Values.idp.debug -}} | ||
{{- print "UU4ySGVPMkxlWE1ZMTBWclA0Y2YyeDVKSFRGSW5tNGY=" -}} | ||
{{- else -}} | ||
{{- printf "%s" ( randAlphaNum 22 | b64enc | quote ) -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the Keycloak endpoint | ||
*/}} | ||
{{- define "ui.keycloak.endpoint" -}} | ||
{{- if .Values.idp.host -}} | ||
{{- .Values.idp.host -}} | ||
{{- else -}} | ||
{{- printf "http://%s-keycloak-headless:8080" .Release.Name -}} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Only created if idp.existingSecret not defined | ||
|
||
{{- if not .Values.idp.existingSecret }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Release.Name }}-node-ui-keycloak-secret | ||
namespace: {{ .Release.Namespace }} | ||
type: Opaque | ||
data: | ||
nodeUiClientSecret: {{- include "ui.keycloak.clientSecret" . | b64dec | indent 2 -}} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters