From 0e5b1d053f243ffca449c0a300c984d51d6bc698 Mon Sep 17 00:00:00 2001 From: liyang Date: Fri, 25 Oct 2024 17:37:38 +0800 Subject: [PATCH] Update charts/greptimedb-standalone/templates/_helpers.tpl Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .../templates/_helpers.tpl | 43 +++++++++++++++---- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/charts/greptimedb-standalone/templates/_helpers.tpl b/charts/greptimedb-standalone/templates/_helpers.tpl index d2b1e9f..0b1f9a6 100644 --- a/charts/greptimedb-standalone/templates/_helpers.tpl +++ b/charts/greptimedb-standalone/templates/_helpers.tpl @@ -63,22 +63,47 @@ Create the name of the service account to use {{- define "greptimedb-standalone.objectStorageConfig" -}} {{- if or .Values.objectStorage.s3 .Values.objectStorage.oss .Values.objectStorage.gcs }} +{{- $provider := "" }} +{{- $bucket := "" }} +{{- $root := "" }} + +{{- if .Values.objectStorage.s3 }} + {{- $provider = "S3" }} + {{- $bucket = .Values.objectStorage.s3.bucket }} + {{- $root = .Values.objectStorage.s3.root }} +{{- else if .Values.objectStorage.oss }} + {{- $provider = "Oss" }} + {{- $bucket = .Values.objectStorage.oss.bucket }} + {{- $root = .Values.objectStorage.oss.root }} +{{- else if .Values.objectStorage.gcs }} + {{- $provider = "Gcs" }} + {{- $bucket = .Values.objectStorage.gcs.bucket }} + {{- $root = .Values.objectStorage.gcs.root }} +{{- end }} + +{{- if and $provider $bucket }} [storage] -type = "{{- if .Values.objectStorage.s3 }}S3{{- else if .Values.objectStorage.oss }}Oss{{- else if .Values.objectStorage.gcs }}Gcs{{- end }}" + # Storage provider type: S3, Oss, or Gcs + type = "{{ $provider }}" -bucket = "{{- if .Values.objectStorage.s3 }}{{ .Values.objectStorage.s3.bucket }}{{- else if .Values.objectStorage.oss }}{{ .Values.objectStorage.oss.bucket }}{{- else if .Values.objectStorage.gcs }}{{ .Values.objectStorage.gcs.bucket }}{{- end }}" + # Bucket name in the storage provider + bucket = "{{ $bucket }}" -root = "{{- if .Values.objectStorage.s3 }}{{ .Values.objectStorage.s3.root }}{{- else if .Values.objectStorage.oss }}{{ .Values.objectStorage.oss.root }}{{- else if .Values.objectStorage.gcs }}{{ .Values.objectStorage.gcs.root }}{{- end }}" + # Root path within the bucket + {{- if $root }} + root = "{{ $root }}" + {{- end }} {{- if .Values.objectStorage.s3 }} -endpoint = "{{ .Values.objectStorage.s3.endpoint }}" -region = "{{ .Values.objectStorage.s3.region }}" + endpoint = "{{ .Values.objectStorage.s3.endpoint }}" + region = "{{ .Values.objectStorage.s3.region }}" {{- else if .Values.objectStorage.oss }} -endpoint = "{{ .Values.objectStorage.oss.endpoint }}" -region = "{{ .Values.objectStorage.oss.region }}" + endpoint = "{{ .Values.objectStorage.oss.endpoint }}" + region = "{{ .Values.objectStorage.oss.region }}" {{- else if .Values.objectStorage.gcs }} -endpoint = "{{ .Values.objectStorage.gcs.endpoint }}" -scope = "{{ .Values.objectStorage.gcs.scope }}" + endpoint = "{{ .Values.objectStorage.gcs.endpoint }}" + scope = "{{ .Values.objectStorage.gcs.scope }}" +{{- end }} {{- end }} {{- end }} {{- end }}