Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make build-in prom compatible with mergeMetrics feature #1192

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions charts/sn-platform-slim/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ sidecar.istio.io/inject: "true"
{{- end }}
{{- end }}

{{/*
Create the monitoring template labels.
*/}}
{{- define "pulsar.monitoring.template.labels" -}}
app: {{ template "pulsar.name" . }}
release: {{ .Release.Name }}
cluster: {{ template "pulsar.fullname" . }}
{{- end }}

{{/*
Create the match labels.
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ spec:
template:
metadata:
labels:
{{- if and .Values.istio.enabled .Values.istio.mergeMetrics }}
{{- include "pulsar.monitoring.template.labels" . | nindent 8 }}
{{- else }}
{{- include "pulsar.template.labels" . | nindent 8 }}
{{- end }}
component: {{ .Values.grafana.component }}
{{- with .Values.grafana.labels }}
{{ toYaml . | indent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ spec:
template:
metadata:
labels:
{{- if and .Values.istio.enabled .Values.istio.mergeMetrics }}
{{- include "pulsar.monitoring.template.labels" . | nindent 8 }}
{{- else }}
{{- include "pulsar.template.labels" . | nindent 8 }}
{{- end }}
component: {{ .Values.grafana.component }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/grafana/grafana-configmap.yaml") . | sha256sum }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ data:
names:
- {{ template "pulsar.namespace" . }}
{{- end }}
{{- if .Values.istio.enabled }}
{{- if .Values.istio.migration }}
{{- if and .Values.istio.enabled (not .Values.istio.mergeMetrics) }}
{{- if .Values.istio.migration }}
scheme: http
enable_http2: false
{{- else }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ spec:
template:
metadata:
labels:
{{- if and .Values.istio.enabled .Values.istio.mergeMetrics }}
{{- include "pulsar.monitoring.template.labels" . | nindent 8 }}
{{- else }}
{{- include "pulsar.template.labels" . | nindent 8 }}
{{- end }}
component: {{ .Values.prometheus.component }}
{{- with .Values.prometheus.labels }}
{{ toYaml . | indent 8 }}
{{- end }}
annotations:
{{- if .Values.istio.enabled }}
{{- if and .Values.istio.enabled (not .Values.istio.mergeMetrics ) }}
# ref: https://istio.io/latest/docs/ops/integrations/prometheus/#tls-settings
traffic.sidecar.istio.io/includeOutboundIPRanges: "" # do not intercept any outbound traffic
# configure an env variable `OUTPUT_CERTS` to write certificates to the given folder
Expand Down Expand Up @@ -154,7 +158,7 @@ spec:
mountPath: /etc/config
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}"
mountPath: /prometheus
{{- if .Values.istio.enabled }}
{{- if and .Values.istio.enabled (not .Values.istio.mergeMetrics ) }}
- name: istio-certs
mountPath: /etc/prom-certs/
{{- end }}
Expand All @@ -163,7 +167,7 @@ spec:
- name: config-volume
configMap:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}"
{{- if .Values.istio.enabled }}
{{- if and .Values.istio.enabled (not .Values.istio.mergeMetrics )}}
- emptyDir:
medium: Memory
name: istio-certs
Expand Down
7 changes: 4 additions & 3 deletions charts/sn-platform-slim/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ bookkeeper:
enabled: false
minReplicas: 1
maxReplicas: 4
metrics: {}
metrics: []
# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# f it is specified will dynamically change the log level and log format of the component by changing the CR.
Expand Down Expand Up @@ -1038,7 +1038,7 @@ broker:
enabled: false
minReplicas: 1
maxReplicas: 4
metrics: {}
metrics: []
# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
Expand Down Expand Up @@ -2144,7 +2144,8 @@ istio:
migration: false
# istio labels used to inject sidecars if it's not `sidecar.istio.io/inject: "true"`
labels: {}
# If you're using the prometheus in this chart, please keep mergeMetrics disabled.
# mergeMetrics should be enabled if you want to scrape pulsar metrics from an external prometheus not running on Istio
# prometheus and grafana will not be Istio injected if mergeMetrics is enabled
mergeMetrics: false
gateway:
# gateway selector if it's not `istio: ingressgateway`
Expand Down
9 changes: 9 additions & 0 deletions charts/sn-platform/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ sidecar.istio.io/inject: "true"
{{- end }}
{{- end }}

{{/*
Create the monitoring template labels.
*/}}
{{- define "pulsar.monitoring.template.labels" -}}
app: {{ template "pulsar.name" . }}
release: {{ .Release.Name }}
cluster: {{ template "pulsar.fullname" . }}
{{- end }}

{{/*
Create the match labels.
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ spec:
template:
metadata:
labels:
{{- if and .Values.istio.enabled .Values.istio.mergeMetrics }}
{{- include "pulsar.monitoring.template.labels" . | nindent 8 }}
{{- else }}
{{- include "pulsar.template.labels" . | nindent 8 }}
{{- end }}
component: {{ .Values.grafana.component }}
{{- with .Values.grafana.labels }}
{{ toYaml . | indent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ spec:
template:
metadata:
labels:
{{- if and .Values.istio.enabled .Values.istio.mergeMetrics }}
{{- include "pulsar.monitoring.template.labels" . | nindent 8 }}
{{- else }}
{{- include "pulsar.template.labels" . | nindent 8 }}
{{- end }}
component: {{ .Values.grafana.component }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/grafana/grafana-configmap.yaml") . | sha256sum }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ data:
names:
- {{ template "pulsar.namespace" . }}
{{- end }}
{{- if .Values.istio.enabled }}
{{- if .Values.istio.migration }}
{{- if and .Values.istio.enabled (not .Values.istio.mergeMetrics) }}
{{- if .Values.istio.migration }}
scheme: http
enable_http2: false
{{- else }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ spec:
template:
metadata:
labels:
{{- if and .Values.istio.enabled .Values.istio.mergeMetrics }}
{{- include "pulsar.monitoring.template.labels" . | nindent 8 }}
{{- else }}
{{- include "pulsar.template.labels" . | nindent 8 }}
{{- end }}
component: {{ .Values.prometheus.component }}
{{- with .Values.prometheus.labels }}
{{ toYaml . | indent 8 }}
{{- end }}
annotations:
{{- if .Values.istio.enabled }}
{{- if and .Values.istio.enabled (not .Values.istio.mergeMetrics ) }}
# ref: https://istio.io/latest/docs/ops/integrations/prometheus/#tls-settings
traffic.sidecar.istio.io/includeOutboundIPRanges: "" # do not intercept any outbound traffic
# configure an env variable `OUTPUT_CERTS` to write certificates to the given folder
Expand Down Expand Up @@ -154,7 +158,7 @@ spec:
mountPath: /etc/config
- name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}-{{ .Values.prometheus.volumes.data.name }}"
mountPath: /prometheus
{{- if .Values.istio.enabled }}
{{- if and .Values.istio.enabled (not .Values.istio.mergeMetrics ) }}
- name: istio-certs
mountPath: /etc/prom-certs/
{{- end }}
Expand All @@ -163,7 +167,7 @@ spec:
- name: config-volume
configMap:
name: "{{ template "pulsar.fullname" . }}-{{ .Values.prometheus.component }}"
{{- if .Values.istio.enabled }}
{{- if and .Values.istio.enabled (not .Values.istio.mergeMetrics ) }}
- emptyDir:
medium: Memory
name: istio-certs
Expand Down
3 changes: 2 additions & 1 deletion charts/sn-platform/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2509,7 +2509,8 @@ istio:
migration: false
# istio labels used to inject sidecars if it's not `sidecar.istio.io/inject: "true"`
labels: {}
# If you're using the prometheus in this chart, please keep mergeMetrics disabled.
# mergeMetrics should be enabled if you want to scrape pulsar metrics from an external prometheus not running on Istio
# prometheus and grafana will not be Istio injected if mergeMetrics is enabled
mergeMetrics: false
gateway:
# gateway selector if it's not `istio: ingressgateway`
Expand Down
Loading