From ab2638aa3d0c6e0289bfe42de6b4047826dafd89 Mon Sep 17 00:00:00 2001 From: Andre Baptista Aguas Date: Wed, 6 Sep 2023 22:23:08 +0200 Subject: [PATCH] guard appProtocol with target kubernetes version check Signed-off-by: Andre Baptista Aguas --- .../templates/alertmanager/service.yaml | 7 +++++-- .../templates/prometheus/service.yaml | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/charts/kube-prometheus-stack/templates/alertmanager/service.yaml b/charts/kube-prometheus-stack/templates/alertmanager/service.yaml index 83f1ce476901..a8fb80f6f5a8 100644 --- a/charts/kube-prometheus-stack/templates/alertmanager/service.yaml +++ b/charts/kube-prometheus-stack/templates/alertmanager/service.yaml @@ -43,8 +43,11 @@ spec: port: {{ .Values.alertmanager.service.port }} targetPort: {{ .Values.alertmanager.service.targetPort }} protocol: TCP - - appProtocol: http - name: reloader-web + - name: reloader-web + {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} + {{- if semverCompare ">=1.20.0-0" $kubeTargetVersion }} + appProtocol: http + {{- end }} port: 8080 targetPort: reloader-web {{- if .Values.alertmanager.service.additionalPorts }} diff --git a/charts/kube-prometheus-stack/templates/prometheus/service.yaml b/charts/kube-prometheus-stack/templates/prometheus/service.yaml index 86cac063ebb5..ea86fa2ce70a 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/service.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/service.yaml @@ -42,8 +42,11 @@ spec: {{- end }} port: {{ .Values.prometheus.service.port }} targetPort: {{ .Values.prometheus.service.targetPort }} - - appProtocol: http - name: reloader-web + - name: reloader-web + {{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} + {{- if semverCompare "> 1.20.0-0" $kubeTargetVersion }} + appProtocol: http + {{- end }} port: 8080 targetPort: reloader-web {{- if .Values.prometheus.thanosIngress.enabled }}