Skip to content

Commit 3735d56

Browse files
authored
Adding envoy port rules (#1315)
* Adding envoy port rules * Update README.md with readme-generator-for-helm Signed-off-by: dunefro <dunefro@users.noreply.github.com> * Added grouping name * Added grouping name --------- Signed-off-by: dunefro <dunefro@users.noreply.github.com> Co-authored-by: dunefro <dunefro@users.noreply.github.com>
1 parent 3b0dac1 commit 3735d56

File tree

5 files changed

+64
-1
lines changed

5 files changed

+64
-1
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
apiVersion: v2
22
name: tfy-prometheus-config
33
description: A Helm chart for Prometheus Config
4-
version: 0.1.16
4+
version: 0.1.17

charts/tfy-prometheus-config/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ This chart is used to configure prometheus. It is used to configure the scrape c
5353
| `prometheusRules.kubecostRules.name` | Name of the prometheus rules | `tfy-alertmanager-config-kubecost-rules` |
5454
| `prometheusRules.kubecostRules.labels` | Labels for the prometheus rules | `{}` |
5555
| `prometheusRules.kubecostRules.annotations` | Annotations for the prometheus rules | `{}` |
56+
| `prometheusRules.envoyPortRules.enabled` | Enable prometheus rules for alerts | `true` |
57+
| `prometheusRules.envoyPortRules.name` | Name of the prometheus rules | `tfy-envoy-port-rules` |
58+
| `prometheusRules.envoyPortRules.labels` | Labels for the prometheus rules | `{}` |
59+
| `prometheusRules.envoyPortRules.annotations` | Annotations for the prometheus rules | `{}` |
60+
| `prometheusRules.envoyPortRules.portList` | List of common ports | `[]` |
5661

5762
### serviceMonitors Service monitors for prometheus
5863

charts/tfy-prometheus-config/templates/_helpers.tpl

+27
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,33 @@ Container rules annotations
308308
{{- end }}
309309
{{- end }}
310310

311+
312+
{{/*
313+
Container rules labels
314+
*/}}
315+
{{- define "envoyPortRules.labels" -}}
316+
{{- if .Values.prometheusRules.envoyPortRules.labels }}
317+
{{- toYaml .Values.prometheusRules.envoyPortRules.labels }}
318+
{{- else if .Values.global.labels }}
319+
{{- toYaml .Values.global.labels }}
320+
{{- else }}
321+
{{- toYaml (dict "release" "prometheus") }}
322+
{{- end }}
323+
{{- end }}
324+
325+
{{/*
326+
Container rules annotations
327+
*/}}
328+
{{- define "envoyPortRules.annotations" -}}
329+
{{- if .Values.prometheusRules.envoyPortRules.annotations }}
330+
{{- toYaml .Values.prometheusRules.envoyPortRules.annotations }}
331+
{{- else if .Values.global.annotations }}
332+
{{- toYaml .Values.global.annotations }}
333+
{{- else }}
334+
{}
335+
{{- end }}
336+
{{- end }}
337+
311338
{{/*
312339
Kubecost rules labels
313340
*/}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if .Values.prometheusRules.envoyPortRules.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PrometheusRule
4+
metadata:
5+
name: {{ .Values.prometheusRules.envoyPortRules.name }}
6+
labels:
7+
{{- include "envoyPortRules.labels" . | nindent 4 }}
8+
annotations:
9+
{{- include "envoyPortRules.annotations" . | nindent 4 }}
10+
spec:
11+
groups:
12+
- name: tfy-envoy-port.rules
13+
interval: 10s
14+
rules:
15+
{{- range $port := .Values.prometheusRules.envoyPortRules.portList }}
16+
- record: envoy_http_inbound_0_0_0_0_{{ $port }}_downstream_rq_total
17+
expr: envoy_http_downstream_rq_total{http_conn_manager_prefix="inbound_0.0.0.0_{{ $port }}"}
18+
{{- end }}
19+
{{- end }}

charts/tfy-prometheus-config/values.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ prometheusRules:
159159
labels: {}
160160
## @param prometheusRules.kubecostRules.annotations [object] Annotations for the prometheus rules
161161
annotations: {}
162+
# prometheusRules.envoyPortRules Prometheus rules for alerts
163+
envoyPortRules:
164+
## @param prometheusRules.envoyPortRules.enabled Enable prometheus rules for alerts
165+
enabled: true
166+
## @param prometheusRules.envoyPortRules.name Name of the prometheus rules
167+
name: tfy-envoy-port-rules
168+
## @param prometheusRules.envoyPortRules.labels [object] Labels for the prometheus rules
169+
labels: {}
170+
## @param prometheusRules.envoyPortRules.annotations [object] Annotations for the prometheus rules
171+
annotations: {}
172+
## @param prometheusRules.envoyPortRules.portList [array] List of common ports
173+
portList: ["80", "443", "3000", "8000", "8080", "8443", "5000", "6000", "9000", "9090", "10000"]
162174
## @section serviceMonitors Service monitors for prometheus
163175
serviceMonitors:
164176
## @param serviceMonitors.enabled Enable service monitors for prometheus

0 commit comments

Comments
 (0)