-
Notifications
You must be signed in to change notification settings - Fork 800
[chart/opentelemetry-ebpf-instrumentation] only configure prometheus_export when a Service can scrape it #2360
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -143,8 +143,25 @@ app.kubernetes.io/instance: {{ .Release.Name }} | |||||||||||
| {{/* | ||||||||||||
| Generate the configmap data based on preset and configuration values | ||||||||||||
| */}} | ||||||||||||
| {{/* | ||||||||||||
| Whether the Prometheus scrape endpoint should be configured. | ||||||||||||
|
|
||||||||||||
| OBI only expires Prometheus metric children while serving a scrape, so an | ||||||||||||
| endpoint that nothing scrapes retains every series for the lifetime of the | ||||||||||||
| process. The ServiceMonitor requires a Service, so service.enabled is the | ||||||||||||
| only condition needed. | ||||||||||||
| */}} | ||||||||||||
| {{- define "obi.prometheusExportEnabled" -}} | ||||||||||||
| {{- if .Values.service.enabled -}} | ||||||||||||
| true | ||||||||||||
| {{- end -}} | ||||||||||||
| {{- end }} | ||||||||||||
|
|
||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| {{- define "obi.configData" -}} | ||||||||||||
| {{- $config := deepCopy .Values.config.data }} | ||||||||||||
| {{- if not (include "obi.prometheusExportEnabled" .) }} | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need an additional template here? Can we simplify with instead? |
||||||||||||
| {{- $_ := unset $config "prometheus_export" }} | ||||||||||||
|
Comment on lines
+162
to
+163
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this setting can also be enabled via config without this preset which requires a service |
||||||||||||
| {{- end }} | ||||||||||||
| {{- if eq .Values.preset "network" }} | ||||||||||||
| {{- if not .Values.config.data.network }} | ||||||||||||
| {{- $_ := set $config "network" (dict "enable" true) }} | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,17 +75,24 @@ spec: | |
| drop: | ||
| - ALL | ||
| {{- end }} | ||
| {{- $promExport := dict }} | ||
| {{- if include "obi.prometheusExportEnabled" . }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
| {{- $promExport = ((.Values.config.data).prometheus_export) | default dict }} | ||
| {{- end }} | ||
| {{- $metricsPort := .Values.service.targetPort | default ($promExport).port }} | ||
| {{- $internalMetricsPort := and | ||
| (or .Values.service.internalMetrics.targetPort ((.Values.config.data.internal_metrics).prometheus).port) | ||
| (ne ($promExport).port ((.Values.config.data.internal_metrics).prometheus).port) | ||
| (ne .Values.service.internalMetrics.targetPort .Values.service.targetPort) }} | ||
| {{- if or $metricsPort $internalMetricsPort .Values.config.data.profile_port }} | ||
| ports: | ||
| {{- if (or (.Values.service.targetPort) ((.Values.config.data.prometheus_export).port)) }} | ||
| {{- end }} | ||
| {{- if $metricsPort }} | ||
| - name: {{ .Values.service.portName }} | ||
| containerPort: {{ .Values.service.targetPort | default .Values.config.data.prometheus_export.port }} | ||
| containerPort: {{ $metricsPort }} | ||
| protocol: TCP | ||
| {{- end }} | ||
| {{- if (and | ||
| (or .Values.service.internalMetrics.targetPort ((.Values.config.data.internal_metrics).prometheus).port) | ||
| (ne ((.Values.config.data).prometheus_export).port ((.Values.config.data.internal_metrics).prometheus).port) | ||
| (ne .Values.service.internalMetrics.targetPort .Values.service.targetPort) | ||
| ) }} | ||
| {{- if $internalMetricsPort }} | ||
| - name: {{ .Values.service.internalMetrics.portName }} | ||
| containerPort: {{ .Values.service.internalMetrics.targetPort | default .Values.config.data.internal_metrics.prometheus.port }} | ||
| protocol: TCP | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.