Skip to content

Commit

Permalink
Update charts/greptimedb-standalone/templates/_helpers.tpl
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
daviderli614 and coderabbitai[bot] authored Oct 25, 2024
1 parent 4348ab3 commit 0e5b1d0
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions charts/greptimedb-standalone/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 0e5b1d0

Please sign in to comment.