From 75425d9de1ebb4505808fc2a391d45c66beb09ab Mon Sep 17 00:00:00 2001 From: Andrii Chubatiuk Date: Sat, 14 Sep 2024 22:43:47 +0300 Subject: [PATCH] k8s-stack: use path prefix from args as a default ingress path --- 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 9418509dd..8757e58fe 100644 --- a/charts/victoria-metrics-k8s-stack/CHANGELOG.md +++ b/charts/victoria-metrics-k8s-stack/CHANGELOG.md @@ -3,6 +3,7 @@ ## Next release - 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 9be1999a5..aee359134 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: "" # 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: "" # 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 @@ -751,7 +753,7 @@ vmagent: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" labels: {} - path: / + path: "" # pathType is only for k8s > 1.19 pathType: Prefix