From dc04aefb69389fbaf90afefa5dc483461091469d Mon Sep 17 00:00:00 2001 From: Andrii Chubatiuk Date: Tue, 10 Sep 2024 17:53:26 +0300 Subject: [PATCH] updated urls and naming --- .../templates/_helpers.tpl | 14 -------------- .../templates/per-az/vmagent.yaml | 2 +- .../templates/per-az/vmauth-read-balancer.yaml | 2 ++ .../templates/per-az/vmauth-read-proxy.yaml | 11 ++++++++--- .../templates/per-az/vmauth-write-balancer.yaml | 3 +++ .../templates/per-az/vmcluster.yaml | 2 +- .../templates/vmauth-read.yaml | 3 +++ .../templates/vmauth-write.yaml | 2 ++ 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/charts/victoria-metrics-distributed/templates/_helpers.tpl b/charts/victoria-metrics-distributed/templates/_helpers.tpl index 987be113e..3b7ed3ac3 100644 --- a/charts/victoria-metrics-distributed/templates/_helpers.tpl +++ b/charts/victoria-metrics-distributed/templates/_helpers.tpl @@ -1,17 +1,3 @@ -{{/* -Create the name for global ingest vmauth -*/}} -{{- define "victoria-metrics-distributed.vmauthIngestGlobalName" -}} - {{- include "vm.service" (dict "helm" . "appKey" (list "write" "global" "vmauth") "style" "managed") -}} -{{- end }} - -{{/* -Create the name for global query vmauth -*/}} -{{- define "victoria-metrics-distributed.vmauthQueryGlobalName" -}} - {{- include "vm.service" (dict "helm" . "appKey" (list "read" "global" "vmauth") "style" "managed") -}} -{{- end }} - {{/* Common labels */}} diff --git a/charts/victoria-metrics-distributed/templates/per-az/vmagent.yaml b/charts/victoria-metrics-distributed/templates/per-az/vmagent.yaml index 41bafcaab..5792b6d19 100644 --- a/charts/victoria-metrics-distributed/templates/per-az/vmagent.yaml +++ b/charts/victoria-metrics-distributed/templates/per-az/vmagent.yaml @@ -25,6 +25,6 @@ metadata: {{- end }} {{- end }} {{- $_ := set $spec "remoteWrite" (concat $remoteWrites ($spec.remoteWrites | default list)) }} -spec: {{ toYaml (omit $spec "remoteWrite") | nindent 2 }} +spec: {{ toYaml $spec | nindent 2 }} {{- end }} {{- end }} diff --git a/charts/victoria-metrics-distributed/templates/per-az/vmauth-read-balancer.yaml b/charts/victoria-metrics-distributed/templates/per-az/vmauth-read-balancer.yaml index f732ac2ca..474823296 100644 --- a/charts/victoria-metrics-distributed/templates/per-az/vmauth-read-balancer.yaml +++ b/charts/victoria-metrics-distributed/templates/per-az/vmauth-read-balancer.yaml @@ -19,8 +19,10 @@ spec: {{ toYaml (omit $spec "unauthorizedAccessConfig") | nindent 2 }} - src_paths: - "/select/.+" {{- $_ := set $ctx "appKey" (list "availabilityZones" $i "vmcluster" "spec" "vmselect") }} + {{- $_ := set $ctx "style" "managed" }} url_prefix: - {{ include "vm.url" $ctx }} + {{- $_ := unset $ctx "style" }} {{- end }} {{- end }} diff --git a/charts/victoria-metrics-distributed/templates/per-az/vmauth-read-proxy.yaml b/charts/victoria-metrics-distributed/templates/per-az/vmauth-read-proxy.yaml index ad3faea15..7fd021749 100644 --- a/charts/victoria-metrics-distributed/templates/per-az/vmauth-read-proxy.yaml +++ b/charts/victoria-metrics-distributed/templates/per-az/vmauth-read-proxy.yaml @@ -21,17 +21,22 @@ spec: {{ toYaml (omit $spec "unauthorizedAccessConfig") | nindent 2 }} load_balancing_policy: first_available retry_status_codes: - 503 + {{- $_ := set $ctx "style" "managed" }} {{- $urls := default list }} {{- if $zone.read.allow }} + {{- $_ := set $ctx "prefix" "read-balancer" }} {{- $_ := set $ctx "appKey" (list "availabilityZones" $i "read" "perZone" "vmauth") }} {{- $urls = append $urls (include "vm.url" $ctx) }} {{- end }} - {{- range $j, $cross := $.Values.availabilityZone }} + {{- $_ := set $ctx "prefix" "read-proxy" }} + {{- range $j, $cross := $.Values.availabilityZones }} {{- if and (ne $j $i) $cross.read.allow }} - {{- $_ := set $ctx "appKey" (list "availabilityZones" $j "read" "crossZone" "vmauth") }} - {{- $urls = append $urls (include "vm.url" )}} + {{- $_ := set $ctx "appKey" (list "availabilityZones" $j "read" "perZone" "vmauth") }} + {{- $urls = append $urls (include "vm.url" $ctx)}} {{- end }} {{- end }} url_prefix: {{ toYaml $urls | nindent 4 }} + {{- $_ := unset $ctx "style" }} + {{- $_ := unset $ctx "prefix" }} {{- end }} {{- end }} diff --git a/charts/victoria-metrics-distributed/templates/per-az/vmauth-write-balancer.yaml b/charts/victoria-metrics-distributed/templates/per-az/vmauth-write-balancer.yaml index 9e23108d2..100c04bc4 100644 --- a/charts/victoria-metrics-distributed/templates/per-az/vmauth-write-balancer.yaml +++ b/charts/victoria-metrics-distributed/templates/per-az/vmauth-write-balancer.yaml @@ -16,10 +16,13 @@ metadata: {{- $spec := $zone.spec | default dict }} {{- $spec = merge (deepCopy $spec) (deepCopy $zone.write.vmauth.spec) }} spec: {{ toYaml (omit $spec "unauthorizedAccessConfig") | nindent 2 }} + {{- $_ := set $ctx "style" "managed" }} + {{- $_ := set $ctx "appKey" (list "availabilityZones" $i "vmcluster" "spec" "vminsert") }} unauthorizedAccessConfig: - src_paths: - "/insert/.+" url_prefix: - {{ include "vm.url" $ctx }} + {{- $_ := unset $ctx "style" }} {{- end }} {{- end }} diff --git a/charts/victoria-metrics-distributed/templates/per-az/vmcluster.yaml b/charts/victoria-metrics-distributed/templates/per-az/vmcluster.yaml index f72575ffe..81e725d5b 100644 --- a/charts/victoria-metrics-distributed/templates/per-az/vmcluster.yaml +++ b/charts/victoria-metrics-distributed/templates/per-az/vmcluster.yaml @@ -7,7 +7,7 @@ metadata: {{- with $rolloutZone.annotations }} annotations: {{ toYaml . | nindent 4 }} {{- end }} - name: vmcluster-{{ $zoneName }} + name: {{ $zoneName }} namespace: {{ include "vm.namespace" $ }} labels: {{ include "victoria-metrics-distributed.labels" $ | nindent 4 }} spec: diff --git a/charts/victoria-metrics-distributed/templates/vmauth-read.yaml b/charts/victoria-metrics-distributed/templates/vmauth-read.yaml index 0e37b8df6..b33134134 100644 --- a/charts/victoria-metrics-distributed/templates/vmauth-read.yaml +++ b/charts/victoria-metrics-distributed/templates/vmauth-read.yaml @@ -12,11 +12,14 @@ spec: - src_paths: - "/select/.+" load_balancing_policy: first_available + {{- $_ := set $ctx "style" "managed" }} + {{- $_ := set $ctx "prefix" "read-proxy" }} {{- $urls := default list }} {{- range $i, $zone := $.Values.availabilityZones }} {{- $_ := set $ctx "appKey" (list "availabilityZones" $i "read" "crossZone" "vmauth") }} {{- $urls = append $urls (include "vm.url" $ctx) }} {{- end }} + {{- $_ := unset $ctx "style" }} url_prefix: {{ toYaml $urls | nindent 4 }} {{- end }} diff --git a/charts/victoria-metrics-distributed/templates/vmauth-write.yaml b/charts/victoria-metrics-distributed/templates/vmauth-write.yaml index 16687b9fe..c954a42c0 100644 --- a/charts/victoria-metrics-distributed/templates/vmauth-write.yaml +++ b/charts/victoria-metrics-distributed/templates/vmauth-write.yaml @@ -22,10 +22,12 @@ spec: - "/write" - "/api/v1/import" - "/api/v1/import/.+" + {{- $_ := set $ctx "style" "managed" }} {{- $urls := default list }} {{- range $i, $zone := $.Values.availabilityZones }} {{- $_ := set $ctx "appKey" (list "availabilityZones" $i "vmagent") }} {{- $urls = append $urls (include "vm.url" $ctx) }} {{- end }} + {{- $_ := unset $ctx "style" }} url_prefix: {{ toYaml $urls | nindent 4 }} {{- end }}