From 21c6597bb14d066b6eaee1f8c426c30ff03f7d64 Mon Sep 17 00:00:00 2001 From: Andrii Chubatiuk Date: Thu, 19 Sep 2024 23:04:37 +0300 Subject: [PATCH] k8s-stack: use path prefix from args as a default ingress path (#1496) * k8s-stack: use path prefix from args as a default ingress path * added default select and insert prefixes * pr comments --- charts/victoria-metrics-k8s-stack/CHANGELOG.md | 1 + .../templates/ingress.yaml | 4 ++-- charts/victoria-metrics-k8s-stack/values.yaml | 16 +++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/charts/victoria-metrics-k8s-stack/CHANGELOG.md b/charts/victoria-metrics-k8s-stack/CHANGELOG.md index 642f3cbcd..32843eff0 100644 --- a/charts/victoria-metrics-k8s-stack/CHANGELOG.md +++ b/charts/victoria-metrics-k8s-stack/CHANGELOG.md @@ -2,6 +2,7 @@ - Added VMAuth to k8s stack. See [this issue](https://github.com/VictoriaMetrics/helm-charts/issues/829) - Fixed ETCD dashboard +- Use path prefix from args as a default path prefix for ingress. Related [issue](https://github.com/VictoriaMetrics/helm-charts/issues/1260) ## 0.25.16 diff --git a/charts/victoria-metrics-k8s-stack/templates/ingress.yaml b/charts/victoria-metrics-k8s-stack/templates/ingress.yaml index 3312a763b..95d5bc298 100644 --- a/charts/victoria-metrics-k8s-stack/templates/ingress.yaml +++ b/charts/victoria-metrics-k8s-stack/templates/ingress.yaml @@ -39,8 +39,8 @@ spec: name: {{ $serviceName }} port: name: {{ $ingress.serviceName | default "http" }} - {{- with $ingress.path }} - path: {{ . }} + {{- with ($ingress.path | default (dig "spec" "extraArgs" "http.pathPrefix" "/" $config)) }} + path: {{ tpl . $ }} {{- end }} {{- with $ingress.pathType }} pathType: {{ . }} diff --git a/charts/victoria-metrics-k8s-stack/values.yaml b/charts/victoria-metrics-k8s-stack/values.yaml index 209c484c3..778f7e008 100644 --- a/charts/victoria-metrics-k8s-stack/values.yaml +++ b/charts/victoria-metrics-k8s-stack/values.yaml @@ -284,7 +284,7 @@ vmsingle: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" labels: {} - path: / + path: "" # pathType is only for k8s > 1.19 pathType: Prefix @@ -381,7 +381,7 @@ vmcluster: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" labels: {} - path: / + path: "" # pathType is only for k8s > 1.19 pathType: Prefix @@ -416,7 +416,7 @@ vmcluster: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" labels: {} - path: / + path: '{{ dig "extraArgs" "http.pathPrefix" "/" .Values.vmcluster.spec.vmselect }}' # pathType is only for k8s > 1.19 pathType: Prefix @@ -451,7 +451,7 @@ vmcluster: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" labels: {} - path: / + path: '{{ dig "extraArgs" "http.pathPrefix" "/" .Values.vmcluster.spec.vminsert }}' # pathType is only for k8s > 1.19 pathType: Prefix @@ -619,7 +619,7 @@ alertmanager: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" labels: {} - path: / + path: '{{ .Values.alertmanager.spec.routePrefix | default "/" }}' # pathType is only for k8s > 1.19 pathType: Prefix @@ -657,6 +657,8 @@ vmalert: image: tag: v1.103.0 evaluationInterval: 15s + extraArgs: + http.pathPrefix: "/" # External labels to add to all generated recording rules and alerts externalLabels: {} @@ -691,7 +693,7 @@ vmalert: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" labels: {} - path: / + path: "" # pathType is only for k8s > 1.19 pathType: Prefix @@ -759,7 +761,7 @@ vmagent: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" labels: {} - path: / + path: "" # pathType is only for k8s > 1.19 pathType: Prefix