mirror of
https://github.com/truenas/charts.git
synced 2026-10-24 23:54:52 +00:00
Dynamically retrieve minio scheme and set it appropriately
This commit is contained in:
@@ -147,7 +147,7 @@ questions:
|
||||
schema:
|
||||
type: string
|
||||
default: null
|
||||
null: true
|
||||
"null": true
|
||||
show_if: [["certificate", "!=", null]]
|
||||
|
||||
- variable: certificate
|
||||
|
||||
@@ -38,3 +38,15 @@ Retrieve private key of minio certificate
|
||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.Values.certificate) -}}
|
||||
{{ include "common.resources.cert" $values }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Retrieve scheme/protocol for minio
|
||||
*/}}
|
||||
{{- define "minio.scheme" -}}
|
||||
{{- if eq (include "minio.certAvailable" .) "true" -}}
|
||||
{{- print "https" -}}
|
||||
{{- else -}}
|
||||
{{- print "http" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
{{ $scheme := "http" }}
|
||||
{{ if eq (include "minio.certAvailable" .) "true" }}
|
||||
{{ $scheme = "https" }}
|
||||
{{ end }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: minio-config
|
||||
data:
|
||||
protocol: {{ $scheme }}
|
||||
protocol: {{ include "minio.scheme" . }}
|
||||
|
||||
@@ -43,8 +43,8 @@ spec:
|
||||
{{ $secretName := (include "minio.secretName" .) }}
|
||||
{{ $envList := (default list .Values.environmentVariables) }}
|
||||
{{ if .Values.minioDomain }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "MINIO_BROWSER_REDIRECT_URL" "value" (printf "https://%s:%d" .Values.minioDomain .Values.service.consolePort)) }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "MINIO_SERVER_URL" "value" (printf "https://%s:%d" .Values.minioDomain .Values.service.nodePort)) }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "MINIO_BROWSER_REDIRECT_URL" "value" (printf "%s://%s:%d" (include "minio.scheme" .) .Values.minioDomain (.Values.service.consolePort | int))) }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "MINIO_SERVER_URL" "value" (printf "%s://%s:%d" (include "minio.scheme" .) .Values.minioDomain (.Values.service.nodePort | int))) }}
|
||||
{{ end }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "MINIO_ACCESS_KEY" "valueFromSecret" true "secretName" $secretName "secretKey" "accesskey") }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "MINIO_SECRET_KEY" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
|
||||
|
||||
@@ -8,9 +8,6 @@ data:
|
||||
accesskey: {{ if .Values.accessKey }}{{ .Values.accessKey | toString | b64enc | quote }}{{ else }}{{ randAlphaNum 20 | b64enc | quote }}{{ end }}
|
||||
secretkey: {{ if .Values.secretKey }}{{ .Values.secretKey | toString | b64enc | quote }}{{ else }}{{ randAlphaNum 40 | b64enc | quote }}{{ end }}
|
||||
{{ if eq (include "minio.certAvailable" .) "true" }}
|
||||
{{ if eq .Values.minioDomain null }}
|
||||
{{ fail "Minio Domain must be specified when TLS is configured" }}
|
||||
{{ end }}
|
||||
certPublicKey: {{ (include "minio.cert.publicKey" .) | toString | b64enc | quote }}
|
||||
certPrivateKey: {{ (include "minio.cert.privateKey" .) | toString | b64enc | quote }}
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user