mirror of
https://github.com/truenas/charts.git
synced 2026-11-18 07:00:07 +00:00
Mount minio configured cert inside pod using secret
This commit is contained in:
1 parent
31530457d0
commit
916fd6e625
4 files changed
+36
-10
No files matched your search
@@ -0,0 +1,25 @@
|
|||||||
|
{{/*
|
||||||
|
Formats volumeMount for Minio tls keys and trusted certs
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.tlsKeysVolumeMount" -}}
|
||||||
|
{{- if eq (include "minio.certAvailable" .) "true" -}}
|
||||||
|
- name: cert-secret-volume
|
||||||
|
mountPath: "/etc/minio/certs"
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Formats volume for Minio tls keys and trusted certs
|
||||||
|
*/}}
|
||||||
|
{{- define "minio.tlsKeysVolume" -}}
|
||||||
|
{{- if eq (include "minio.certAvailable" .) "true" -}}
|
||||||
|
- name: cert-secret-volume
|
||||||
|
secret:
|
||||||
|
secretName: {{ include "minio.secretName" . }}
|
||||||
|
items:
|
||||||
|
- key: certPublicKey
|
||||||
|
path: public.crt
|
||||||
|
- key: certPrivateKey
|
||||||
|
path: private.key
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
@@ -11,7 +11,7 @@ Retrieve true/false if minio certificate is configured
|
|||||||
*/}}
|
*/}}
|
||||||
{{- define "minio.certAvailable" -}}
|
{{- define "minio.certAvailable" -}}
|
||||||
{{- $values := (. | mustDeepCopy) -}}
|
{{- $values := (. | mustDeepCopy) -}}
|
||||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.certificate) -}}
|
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.Values.certificate) -}}
|
||||||
{{- template "common.resources.cert_present" $values -}}
|
{{- template "common.resources.cert_present" $values -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ Retrieve public key of minio certificate
|
|||||||
*/}}
|
*/}}
|
||||||
{{- define "minio.cert.publicKey" -}}
|
{{- define "minio.cert.publicKey" -}}
|
||||||
{{- $values := (. | mustDeepCopy) -}}
|
{{- $values := (. | mustDeepCopy) -}}
|
||||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.certificate "publicKey" true) -}}
|
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.Values.certificate "publicKey" true) -}}
|
||||||
{{ include "common.resources.cert" $values }}
|
{{ include "common.resources.cert" $values }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
@@ -31,6 +31,6 @@ Retrieve private key of minio certificate
|
|||||||
*/}}
|
*/}}
|
||||||
{{- define "minio.cert.privateKey" -}}
|
{{- define "minio.cert.privateKey" -}}
|
||||||
{{- $values := (. | mustDeepCopy) -}}
|
{{- $values := (. | mustDeepCopy) -}}
|
||||||
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.certificate) -}}
|
{{- $_ := set $values "commonCertOptions" (dict "certKeyName" $values.Values.certificate) -}}
|
||||||
{{ include "common.resources.cert" $values }}
|
{{ include "common.resources.cert" $values }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
{{ $scheme := "http" }}
|
|
||||||
apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
|
apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
@@ -29,13 +28,14 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
|
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
|
||||||
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
|
volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
|
||||||
|
{{- include "minio.tlsKeysVolumeMount" . | nindent 12 }}
|
||||||
command:
|
command:
|
||||||
- "/bin/sh"
|
- "/bin/sh"
|
||||||
- "-ce"
|
- "-ce"
|
||||||
- "/usr/bin/docker-entrypoint.sh minio server /export {{ (.Values.extraArgs | default list) | join " " }}"
|
- "/usr/bin/docker-entrypoint.sh minio server /export {{ (.Values.extraArgs | default list) | join " " }}"
|
||||||
ports:
|
ports:
|
||||||
- name: {{ $scheme }}
|
- name: http
|
||||||
containerPort: 9000
|
containerPort: 9000
|
||||||
env:
|
env:
|
||||||
{{ $secretName := (include "minio.secretName" .) }}
|
{{ $secretName := (include "minio.secretName" .) }}
|
||||||
@@ -44,3 +44,4 @@ spec:
|
|||||||
{{ $envList = mustAppend $envList (dict "name" "MINIO_SECRET_KEY" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
|
{{ $envList = mustAppend $envList (dict "name" "MINIO_SECRET_KEY" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
|
||||||
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
|
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
|
||||||
{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
|
{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
|
||||||
|
{{- include "minio.tlsKeysVolume" . | nindent 8 }}
|
||||||
@@ -7,7 +7,7 @@ type: Opaque
|
|||||||
data:
|
data:
|
||||||
accesskey: {{ if .Values.accessKey }}{{ .Values.accessKey | toString | b64enc | quote }}{{ else }}{{ randAlphaNum 20 | b64enc | quote }}{{ end }}
|
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 }}
|
secretkey: {{ if .Values.secretKey }}{{ .Values.secretKey | toString | b64enc | quote }}{{ else }}{{ randAlphaNum 40 | b64enc | quote }}{{ end }}
|
||||||
{{- if eq (include "minio.certAvailable" .) true -}}
|
{{ if eq (include "minio.certAvailable" .) "true" }}
|
||||||
certPublicKey: {{ template "minio.cert.publicKey" . }}
|
certPublicKey: {{ (include "minio.cert.publicKey" .) | toString | b64enc | quote }}
|
||||||
certPrivateKey: {{ template "minio.cert.privateKey" . }}
|
certPrivateKey: {{ (include "minio.cert.privateKey" .) | toString | b64enc | quote }}
|
||||||
{{- end -}}
|
{{ end }}
|
||||||
Reference in new issue
Block a user