Skip to content

Commit

Permalink
fixed multitenancy opts
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewChubatiuk committed Sep 24, 2024
1 parent d4bc969 commit 56f579b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- $ctx := dict "helm" . }}
{{- $tenant := ternary "multitenant" "0" .Values.enableMultitenancy }}
{{- $isMultitenant := .Values.enableMultitenancy }}
{{- $tenant := ternary "multitenant" "0" $isMultitenant }}
{{- range $i, $zone := .Values.availabilityZones }}
{{- if $zone.vmagent.enabled }}
{{- if (($zone.vmagent).spec).remoteWrite }}
Expand All @@ -16,7 +17,7 @@ metadata:
{{- $_ := set $ctx "appKey" (list "availabilityZones" $i "vmagent") }}
name: {{ include "vm.fullname" $ctx }}
namespace: {{ include "vm.namespace" $ }}
{{- $spec := mergeOverwrite (deepCopy ($zone.common).spec) (deepCopy ($zone.vmagent).spec) }}
{{- $spec := mergeOverwrite (deepCopy $.Values.common.vmagent.spec) (deepCopy ($zone.common).spec) (deepCopy ($zone.vmagent).spec) }}
{{- $remoteWrites := default list }}
{{- range $rwZone := $.Values.availabilityZones }}
{{- if $rwZone.write.allow }}
Expand All @@ -30,6 +31,9 @@ metadata:
{{- end }}
{{- end }}
{{- $_ := set $spec "remoteWrite" (concat $remoteWrites ($spec.remoteWrites | default list)) }}
{{- if $isMultitenant }}
{{- $_ := set $spec "remoteWriteSettings" (dict "useMultitenantMode" true) }}
{{- end }}
spec: {{ toYaml $spec | nindent 2 }}
{{- end }}
{{- end }}
4 changes: 1 addition & 3 deletions charts/victoria-metrics-distributed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ common:
vmagent:
# -- Common VMAgent spec, which can be overriden by each VMAgent configuration.
# Available parameters can be found [here](https://docs.victoriametrics.com/operator/api/index.html#vmagentspec)
spec:
remoteWriteSettings:
useMultiTenantMode: true
spec: {}
vmcluster:
# -- Common VMCluster spec, which can be overriden by each VMCluster configuration.
# Available parameters can be found [here](https://docs.victoriametrics.com/operator/api/index.html#vmclusterspec)
Expand Down

0 comments on commit 56f579b

Please sign in to comment.