Skip to content

Commit

Permalink
fixed distributed resources name context
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewChubatiuk committed Sep 12, 2024
1 parent fe7522e commit c1ae336
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- $ctx := dict "helm" . }}
{{- $tenant := ternary "multitenant" "0" .Values.enableMultitenancy }}
{{- range $zone := .Values.availabilityZones }}
{{- range $i, $zone := .Values.availabilityZones }}
{{- if $zone.vmagent.enabled }}
{{- if (($zone.vmagent).spec).remoteWrite }}
{{- fail "Error: distributed vmagent doesn't support customized remoteWrite address" }}
Expand All @@ -13,6 +13,7 @@ metadata:
{{- with $zone.vmagent.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
{{- $_ := 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) }}
Expand All @@ -24,6 +25,6 @@ metadata:
{{- end }}
{{- end }}
{{- $_ := set $spec "remoteWrite" (concat $remoteWrites ($spec.remoteWrites | default list)) }}
spec: {{ toYaml (omit $spec "unauthorizedAccessConfig") | nindent 2 }}
spec: {{ toYaml (omit $spec "remoteWrite") | nindent 2 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
{{- $_ := set $ctx "appKey" (list "availabilityZones" $i "read" "perZone" "vmauth") }}
name: read-balancer-{{ include "vm.fullname" $ctx }}
namespace: {{ $ns }}
labels: {{ include "victoria-metrics-distributed.labels" $ | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
{{- $_ := set $ctx "appKey" (list "availabilityZones" $i "read" "crossZone" "vmauth") }}
name: read-proxy-{{ include "vm.fullname" $ctx }}
namespace: {{ $ns }}
labels: {{ include "victoria-metrics-distributed.labels" $ | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
name: write-balancer-{{ include "vm.fullname" $ }}
{{- $_ := set $ctx "appKey" (list "availabilityZones" $i "write" "vmauth") }}
name: write-balancer-{{ include "vm.fullname" $ctx }}
namespace: {{ include "vm.namespace" $ }}
labels: {{ include "victoria-metrics-distributed.labels" $ | nindent 4 }}
{{- with $zone.write.vmauth.annotations }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if .Values.read.global.vmauth.enabled }}
{{- $ctx := dict "helm" . }}
{{- $ctx := dict "helm" . "appKey" (list "write" "global" "vmauth") }}
---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
name: read-global-{{ include "vm.fullname" . }}
name: read-global-{{ include "vm.fullname" $ctx }}
namespace: {{ include "vm.namespace" . }}
labels: {{ include "victoria-metrics-distributed.labels" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if .Values.write.global.vmauth.enabled }}
{{- $ctx := dict "helm" . }}
{{- $ctx := dict "helm" . "appKey" (list "write" "global" "vmauth") }}
---
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAuth
metadata:
name: write-global-{{ include "vm.fullname" . }}
name: write-global-{{ include "vm.fullname" $ctx }}
namespace: {{ include "vm.namespace" . }}
labels: {{ include "victoria-metrics-distributed.labels" . | nindent 4 }}
{{- with .Values.write.global.vmauth.annotations }}
Expand Down

0 comments on commit c1ae336

Please sign in to comment.