Skip to content

Commit

Permalink
Disable prom Istio when mergeMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ciiiii committed Nov 21, 2024
1 parent 3346912 commit 66b8ba8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
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
4 changes: 4 additions & 0 deletions charts/sn-platform/templates/grafana/grafana-deployment.yaml
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
4 changes: 4 additions & 0 deletions charts/sn-platform/templates/grafana/grafana-statefulset.yaml
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 or .Values.istio.migration .Values.istio.mergeMetrics }}
{{- 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
1 change: 1 addition & 0 deletions charts/sn-platform/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2510,6 +2510,7 @@ istio:
# istio labels used to inject sidecars if it's not `sidecar.istio.io/inject: "true"`
labels: {}
# 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

0 comments on commit 66b8ba8

Please sign in to comment.