From c0a8c1b97f0e096491fe179df58802ee1e6d6166 Mon Sep 17 00:00:00 2001 From: MMeent Date: Wed, 26 Jan 2022 14:38:52 +0100 Subject: [PATCH] Use the 'pulsar.matchLabels' template for matching components of this chart. (#118) This also limits the scope of the PodMonitors to the resources of only this install, instead of all installs that share `component:` label values. Co-authored-by: Matthias van de Meent --- charts/pulsar/templates/autorecovery-podmonitor.yaml | 1 + charts/pulsar/templates/autorecovery-service.yaml | 3 +-- charts/pulsar/templates/bookkeeper-podmonitor.yaml | 1 + charts/pulsar/templates/broker-podmonitor.yaml | 1 + charts/pulsar/templates/broker-service.yaml | 3 +-- charts/pulsar/templates/dashboard-deployment.yaml | 3 +-- charts/pulsar/templates/dashboard-service.yaml | 3 +-- charts/pulsar/templates/prometheus-service.yaml | 3 +-- charts/pulsar/templates/proxy-podmonitor.yaml | 1 + charts/pulsar/templates/proxy-service.yaml | 3 +-- charts/pulsar/templates/pulsar-manager-service.yaml | 3 +-- charts/pulsar/templates/zookeeper-podmonitor.yaml | 1 + 12 files changed, 12 insertions(+), 14 deletions(-) diff --git a/charts/pulsar/templates/autorecovery-podmonitor.yaml b/charts/pulsar/templates/autorecovery-podmonitor.yaml index 21d9b9f..3ec8968 100644 --- a/charts/pulsar/templates/autorecovery-podmonitor.yaml +++ b/charts/pulsar/templates/autorecovery-podmonitor.yaml @@ -50,5 +50,6 @@ spec: targetLabel: kubernetes_pod_name selector: matchLabels: + {{- include "pulsar.matchLabels" . | nindent 6 }} component: {{ .Values.autorecovery.component }} {{- end }} \ No newline at end of file diff --git a/charts/pulsar/templates/autorecovery-service.yaml b/charts/pulsar/templates/autorecovery-service.yaml index a6cb064..1ab741f 100644 --- a/charts/pulsar/templates/autorecovery-service.yaml +++ b/charts/pulsar/templates/autorecovery-service.yaml @@ -32,8 +32,7 @@ spec: port: {{ .Values.autorecovery.ports.http }} clusterIP: None selector: - app: {{ template "pulsar.name" . }} - release: {{ .Release.Name }} + {{- include "pulsar.matchLabels" . | nindent 4 }} component: {{ .Values.autorecovery.component }} {{- end }} diff --git a/charts/pulsar/templates/bookkeeper-podmonitor.yaml b/charts/pulsar/templates/bookkeeper-podmonitor.yaml index 45a4aad..c30ab1d 100644 --- a/charts/pulsar/templates/bookkeeper-podmonitor.yaml +++ b/charts/pulsar/templates/bookkeeper-podmonitor.yaml @@ -50,5 +50,6 @@ spec: targetLabel: kubernetes_pod_name selector: matchLabels: + {{- include "pulsar.matchLabels" . | nindent 6 }} component: bookie {{- end }} \ No newline at end of file diff --git a/charts/pulsar/templates/broker-podmonitor.yaml b/charts/pulsar/templates/broker-podmonitor.yaml index 515d218..e2b6b8f 100644 --- a/charts/pulsar/templates/broker-podmonitor.yaml +++ b/charts/pulsar/templates/broker-podmonitor.yaml @@ -50,5 +50,6 @@ spec: targetLabel: kubernetes_pod_name selector: matchLabels: + {{- include "pulsar.matchLabels" . | nindent 6 }} component: broker {{- end }} \ No newline at end of file diff --git a/charts/pulsar/templates/broker-service.yaml b/charts/pulsar/templates/broker-service.yaml index c31d74e..5f0161b 100644 --- a/charts/pulsar/templates/broker-service.yaml +++ b/charts/pulsar/templates/broker-service.yaml @@ -45,7 +45,6 @@ spec: {{- end }} clusterIP: None selector: - app: {{ template "pulsar.name" . }} - release: {{ .Release.Name }} + {{- include "pulsar.matchLabels" . | nindent 4 }} component: {{ .Values.broker.component }} {{- end }} diff --git a/charts/pulsar/templates/dashboard-deployment.yaml b/charts/pulsar/templates/dashboard-deployment.yaml index 9a0a3a7..343d022 100644 --- a/charts/pulsar/templates/dashboard-deployment.yaml +++ b/charts/pulsar/templates/dashboard-deployment.yaml @@ -30,8 +30,7 @@ spec: replicas: {{ .Values.dashboard.replicaCount }} selector: matchLabels: - app: {{ template "pulsar.name" . }} - release: {{ .Release.Name }} + {{- include "pulsar.matchLabels" . | nindent 6 }} component: {{ .Values.dashboard.component }} template: metadata: diff --git a/charts/pulsar/templates/dashboard-service.yaml b/charts/pulsar/templates/dashboard-service.yaml index b306ec7..46f9bb7 100644 --- a/charts/pulsar/templates/dashboard-service.yaml +++ b/charts/pulsar/templates/dashboard-service.yaml @@ -33,7 +33,6 @@ spec: {{ toYaml .Values.dashboard.service.ports | indent 2 }} clusterIP: None selector: - app: {{ template "pulsar.name" . }} - release: {{ .Release.Name }} + {{- include "pulsar.matchLabels" . | nindent 4 }} component: {{ .Values.dashboard.component }} {{- end }} diff --git a/charts/pulsar/templates/prometheus-service.yaml b/charts/pulsar/templates/prometheus-service.yaml index 8cbc1f9..3001c25 100644 --- a/charts/pulsar/templates/prometheus-service.yaml +++ b/charts/pulsar/templates/prometheus-service.yaml @@ -34,7 +34,6 @@ spec: - name: server port: {{ .Values.prometheus.port }} selector: - app: {{ template "pulsar.name" . }} - release: {{ .Release.Name }} + {{- include "pulsar.matchLabels" . | nindent 4 }} component: {{ .Values.prometheus.component }} {{- end }} diff --git a/charts/pulsar/templates/proxy-podmonitor.yaml b/charts/pulsar/templates/proxy-podmonitor.yaml index 18fd9ed..7f61522 100644 --- a/charts/pulsar/templates/proxy-podmonitor.yaml +++ b/charts/pulsar/templates/proxy-podmonitor.yaml @@ -50,5 +50,6 @@ spec: targetLabel: kubernetes_pod_name selector: matchLabels: + {{- include "pulsar.matchLabels" . | nindent 6 }} component: proxy {{- end }} \ No newline at end of file diff --git a/charts/pulsar/templates/proxy-service.yaml b/charts/pulsar/templates/proxy-service.yaml index b9678f5..42d4081 100644 --- a/charts/pulsar/templates/proxy-service.yaml +++ b/charts/pulsar/templates/proxy-service.yaml @@ -50,7 +50,6 @@ spec: protocol: TCP {{- end }} selector: - app: {{ template "pulsar.name" . }} - release: {{ .Release.Name }} + {{- include "pulsar.matchLabels" . | nindent 4 }} component: {{ .Values.proxy.component }} {{- end }} diff --git a/charts/pulsar/templates/pulsar-manager-service.yaml b/charts/pulsar/templates/pulsar-manager-service.yaml index ae02f19..3c2450e 100644 --- a/charts/pulsar/templates/pulsar-manager-service.yaml +++ b/charts/pulsar/templates/pulsar-manager-service.yaml @@ -36,8 +36,7 @@ spec: targetPort: {{ .Values.pulsar_manager.service.targetPort }} protocol: TCP selector: - app: {{ template "pulsar.name" . }} - release: {{ .Release.Name }} + {{- include "pulsar.matchLabels" . | nindent 4 }} component: {{ .Values.pulsar_manager.component }} {{- if .Values.pulsar_manager.service.loadBalancerSourceRanges }} loadBalancerSourceRanges: diff --git a/charts/pulsar/templates/zookeeper-podmonitor.yaml b/charts/pulsar/templates/zookeeper-podmonitor.yaml index 0ca8853..dda06d9 100644 --- a/charts/pulsar/templates/zookeeper-podmonitor.yaml +++ b/charts/pulsar/templates/zookeeper-podmonitor.yaml @@ -50,5 +50,6 @@ spec: targetLabel: kubernetes_pod_name selector: matchLabels: + {{- include "pulsar.matchLabels" . | nindent 6 }} component: zookeeper {{- end }} \ No newline at end of file