From fbc31be962497718914f33834875490cbb6825b4 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Thu, 27 Jul 2023 20:59:51 +0300 Subject: [PATCH] Add some extra validation on minio (#1390) --- library/ix-dev/enterprise/minio/Chart.yaml | 2 +- .../ix-dev/enterprise/minio/questions.yaml | 2 +- .../enterprise/minio/templates/_helpers.tpl | 21 ++++++++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/library/ix-dev/enterprise/minio/Chart.yaml b/library/ix-dev/enterprise/minio/Chart.yaml index 6b0ac564cb..9ab3da0fb3 100644 --- a/library/ix-dev/enterprise/minio/Chart.yaml +++ b/library/ix-dev/enterprise/minio/Chart.yaml @@ -3,7 +3,7 @@ description: High Performance, Kubernetes Native Object Storage annotations: title: MinIO type: application -version: 1.0.19 +version: 1.0.20 apiVersion: v2 appVersion: '2023-03-24' kubeVersion: '>=1.16.0-0' diff --git a/library/ix-dev/enterprise/minio/questions.yaml b/library/ix-dev/enterprise/minio/questions.yaml index 231d6f6e93..c31eceb879 100644 --- a/library/ix-dev/enterprise/minio/questions.yaml +++ b/library/ix-dev/enterprise/minio/questions.yaml @@ -141,7 +141,7 @@ questions: For Multi Node Multi Drive (MNMD), the entry will look like this:
Example Entry - https://minio{1...3}.example.com:30000/data{1...4}

Note that each host must use the same port number and the same number of storage items.
- In both cases /data{1..4} is the directories to be used for MinIO. + In both cases /data{1...4} is the directories to be used for MinIO. You have to add additional storage for each data entry. schema: type: boolean diff --git a/library/ix-dev/enterprise/minio/templates/_helpers.tpl b/library/ix-dev/enterprise/minio/templates/_helpers.tpl index 9808d6cbc5..770a867fe7 100644 --- a/library/ix-dev/enterprise/minio/templates/_helpers.tpl +++ b/library/ix-dev/enterprise/minio/templates/_helpers.tpl @@ -39,7 +39,26 @@ {{- end -}} {{- if and (ne (len .Values.minioStorage) 1) (not .Values.minioMultiMode) -}} - {{- fail "Expected Multi Mode to be enabled, when more than 1 storage items added" -}} + {{- fail "Expected Multi Mode to be enabled, when more than 1 storage mountPaths added" -}} + {{- end -}} + + {{- range $item := .Values.minioMultiMode -}} + {{- if hasPrefix "/" $item -}} + {{- if or (contains "{" $item) (contains "}" $item) -}} + {{- if not (contains "..." $item) -}} + {{- fail "Expected Multi Mode Item to have 3 dots when its a path with expansion eg [/some_path{1...4}]" -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + + {{- $mountPaths := list -}} + {{- range $item := .Values.minioStorage -}} + {{- $mountPaths = mustAppend $mountPaths $item.mountPath -}} + {{- end -}} + + {{- if not (deepEqual ($mountPaths) (uniq $mountPaths)) -}} + {{- fail (printf "Expected mountPaths to be unique, but got [%v]" (join ", " $mountPaths)) -}} {{- end -}} {{- end -}}