Unverified Commit 2e91ae01 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by GitHub

Merge pull request #193 from truenas/NAS-112865

NAS-112865 / 22.02-RC.2 / Allow connecting minio instance to a minio cluster
parents c2db867c b4d15d77
......@@ -16,4 +16,4 @@ sources:
- https://github.com/minio/minio
- https://github.com/minio/charts
upstream_version: 8.0.5
version: 1.3.22
version: 1.4.0
......@@ -3,10 +3,10 @@ groups:
description: "Image to be used for container"
- name: "Workload Configuration"
description: "Configure workload deployment"
- name: "Storage"
description: "Configure Storage for Nextcloud"
- name: "Minio Configuration"
description: "Configure Minio credentials"
- name: "Storage"
description: "Configure Storage for Nextcloud"
- name: "Advanced DNS Settings"
description: "Configure DNS settings"
......@@ -60,6 +60,29 @@ questions:
- value: "Recreate"
description: "Kill existing pods before creating new ones"
- variable: distributedMode
label: "Enable Distributed Mode"
description: "Run Minio instance to connect to a distributed minio cluster"
group: "Minio Configuration"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: distributedIps
label: "Distributed Minio Instance URI(s)"
schema:
type: list
required: true
default: []
items:
- variable: ip
label: "Distributed Minio Instance URI"
schema:
type: string
empty: false
- variable: extraArgs
label: "Minio Extra Arguments"
group: "Minio Configuration"
......@@ -164,6 +187,7 @@ questions:
group: "Storage"
schema:
type: dict
show_if: [["distributedMode", "=", false]]
attrs:
- variable: export
label: "Data Volume"
......@@ -200,3 +224,28 @@ questions:
schema:
type: hostpath
required: true
- variable: extraAppVolumeMounts
label: "Extra Host Path Volumes"
group: "Storage"
schema:
type: list
items:
- variable: extraAppVolume
label: "Host Path Volume"
description: "Add an extra host path volume for Minio application"
schema:
type: dict
attrs:
- variable: mountPath
label: "Mount Path in Pod"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
required: true
- variable: hostPath
label: "Host Path"
description: "Host path"
schema:
type: hostpath
required: true
......@@ -50,3 +50,28 @@ Retrieve scheme/protocol for minio
{{- print "http" -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve command for minio application
*/}}
{{- define "minio.commandArgs" -}}
{{- $arg := "/usr/bin/docker-entrypoint.sh minio -S /etc/minio/certs server --console-address=':9001'" -}}
{{- if .Values.distributedMode -}}
{{- cat $arg (join " " (concat (.Values.distributedIps | default list) (.Values.extraArgs | default list))) -}}
{{- else -}}
{{- cat $arg ((concat (list "/export") (.Values.extraArgs | default list)) | join " ") -}}
{{- end -}}
{{- end -}}
{{/*
Enable host networking
*/}}
{{- define "minio.hostNetworking" -}}
{{- if .Values.distributedMode -}}
{{- print "true" -}}
{{- else -}}
{{- print "false" -}}
{{- end -}}
{{- end -}}
......@@ -7,6 +7,8 @@ metadata:
chart: {{ template "common.names.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec:
replicas: {{ (default 1 .Values.replicas) }}
strategy:
......@@ -25,15 +27,20 @@ spec:
annotations: {{ include "common.annotations" . | nindent 8 }}
spec:
serviceAccountName: {{ include "common.names.serviceAccountName" . | quote }}
hostNetwork: {{ include "minio.hostNetworking" . }}
containers:
- name: {{ .Chart.Name }}
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
{{- include "minio.tlsKeysVolumeMount" . | nindent 12 }}
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- name: extrappvolume-{{ $index }}
mountPath: {{ $hostPathConfiguration.mountPath }}
{{ end }}
command:
- "/bin/sh"
- "-ce"
- "/usr/bin/docker-entrypoint.sh minio -S /etc/minio/certs server /export --console-address=':9001' {{ (.Values.extraArgs | default list) | join " " }}"
- {{ include "minio.commandArgs" . }}
ports:
- name: api
containerPort: 9000
......@@ -50,5 +57,10 @@ spec:
{{ $envList = mustAppend $envList (dict "name" "MINIO_ROOT_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
{{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
{{- include "minio.tlsKeysVolume" . | nindent 8 }}
volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
{{- include "minio.tlsKeysVolume" . | nindent 8 }}
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- name: extrappvolume-{{ $index }}
hostPath:
path: {{ $hostPathConfiguration.hostPath }}
{{ end }}
......@@ -16,3 +16,6 @@ service:
consolePort: 32325
nodePort: 32324
updateStrategy: RollingUpdate
distributedMode: false
distributedIps: []
extraAppVolumeMounts: []
......@@ -16,4 +16,4 @@ sources:
- https://github.com/minio/minio
- https://github.com/minio/charts
upstream_version: 8.0.5
version: 1.3.22
version: 1.4.0
......@@ -3,10 +3,10 @@ groups:
description: "Image to be used for container"
- name: "Workload Configuration"
description: "Configure workload deployment"
- name: "Storage"
description: "Configure Storage for Nextcloud"
- name: "Minio Configuration"
description: "Configure Minio credentials"
- name: "Storage"
description: "Configure Storage for Nextcloud"
- name: "Advanced DNS Settings"
description: "Configure DNS settings"
......@@ -60,6 +60,29 @@ questions:
- value: "Recreate"
description: "Kill existing pods before creating new ones"
- variable: distributedMode
label: "Enable Distributed Mode"
description: "Run Minio instance to connect to a distributed minio cluster"
group: "Minio Configuration"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: distributedIps
label: "Distributed Minio Instance URI(s)"
schema:
type: list
required: true
default: []
items:
- variable: ip
label: "Distributed Minio Instance URI"
schema:
type: string
empty: false
- variable: extraArgs
label: "Minio Extra Arguments"
group: "Minio Configuration"
......@@ -164,6 +187,7 @@ questions:
group: "Storage"
schema:
type: dict
show_if: [["distributedMode", "=", false]]
attrs:
- variable: export
label: "Data Volume"
......@@ -200,3 +224,28 @@ questions:
schema:
type: hostpath
required: true
- variable: extraAppVolumeMounts
label: "Extra Host Path Volumes"
group: "Storage"
schema:
type: list
items:
- variable: extraAppVolume
label: "Host Path Volume"
description: "Add an extra host path volume for Minio application"
schema:
type: dict
attrs:
- variable: mountPath
label: "Mount Path in Pod"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
required: true
- variable: hostPath
label: "Host Path"
description: "Host path"
schema:
type: hostpath
required: true
......@@ -50,3 +50,28 @@ Retrieve scheme/protocol for minio
{{- print "http" -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve command for minio application
*/}}
{{- define "minio.commandArgs" -}}
{{- $arg := "/usr/bin/docker-entrypoint.sh minio -S /etc/minio/certs server --console-address=':9001'" -}}
{{- if .Values.distributedMode -}}
{{- cat $arg (join " " (concat (.Values.distributedIps | default list) (.Values.extraArgs | default list))) -}}
{{- else -}}
{{- cat $arg ((concat (list "/export") (.Values.extraArgs | default list)) | join " ") -}}
{{- end -}}
{{- end -}}
{{/*
Enable host networking
*/}}
{{- define "minio.hostNetworking" -}}
{{- if .Values.distributedMode -}}
{{- print "true" -}}
{{- else -}}
{{- print "false" -}}
{{- end -}}
{{- end -}}
......@@ -7,6 +7,8 @@ metadata:
chart: {{ template "common.names.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec:
replicas: {{ (default 1 .Values.replicas) }}
strategy:
......@@ -25,15 +27,20 @@ spec:
annotations: {{ include "common.annotations" . | nindent 8 }}
spec:
serviceAccountName: {{ include "common.names.serviceAccountName" . | quote }}
hostNetwork: {{ include "minio.hostNetworking" . }}
containers:
- name: {{ .Chart.Name }}
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
{{- include "minio.tlsKeysVolumeMount" . | nindent 12 }}
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- name: extrappvolume-{{ $index }}
mountPath: {{ $hostPathConfiguration.mountPath }}
{{ end }}
command:
- "/bin/sh"
- "-ce"
- "/usr/bin/docker-entrypoint.sh minio -S /etc/minio/certs server /export --console-address=':9001' {{ (.Values.extraArgs | default list) | join " " }}"
- {{ include "minio.commandArgs" . }}
ports:
- name: api
containerPort: 9000
......@@ -50,5 +57,10 @@ spec:
{{ $envList = mustAppend $envList (dict "name" "MINIO_ROOT_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
{{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
{{- include "minio.tlsKeysVolume" . | nindent 8 }}
volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
{{- include "minio.tlsKeysVolume" . | nindent 8 }}
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- name: extrappvolume-{{ $index }}
hostPath:
path: {{ $hostPathConfiguration.hostPath }}
{{ end }}
......@@ -16,3 +16,6 @@ service:
consolePort: 32325
nodePort: 32324
updateStrategy: RollingUpdate
distributedMode: false
distributedIps: []
extraAppVolumeMounts: []
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment