Dynamically generate list of rules files for prometheus
This enables the dynamic generation of the list of rules files for prometheus, driven by the rules added in the appropriate tree under .Values.conf.prometheus.rules. This removes the necessity of adding the file name manually in addition to defining the rules in the rules tree, which should reduce overhead associated with adding new rules for prometheus to evaluate Change-Id: Ib768a252c5ea4f2d099df534c3ffcfb2949d7481
This commit is contained in:
parent
3c66523aab
commit
616c351fa7
@ -16,6 +16,18 @@ limitations under the License.
|
|||||||
|
|
||||||
{{- if .Values.manifests.configmap_etc }}
|
{{- if .Values.manifests.configmap_etc }}
|
||||||
{{- $envAll := . }}
|
{{- $envAll := . }}
|
||||||
|
|
||||||
|
{{- if empty $envAll.Values.conf.prometheus.scrape_configs.rule_files -}}
|
||||||
|
{{- $_ := set $envAll.Values "__rule_files" ( list ) }}
|
||||||
|
{{- $rulesKeys := keys $envAll.Values.conf.prometheus.rules -}}
|
||||||
|
{{- range $rule := $rulesKeys }}
|
||||||
|
{{- $rulesFile := printf "/etc/config/rules/%s.rules" $rule }}
|
||||||
|
{{- $__rule_files := append $envAll.Values.__rule_files $rulesFile }}
|
||||||
|
{{- $_ := set $envAll.Values "__rule_files" $__rule_files }}
|
||||||
|
{{ end }}
|
||||||
|
{{- set .Values.conf.prometheus.scrape_configs "rule_files" $envAll.Values.__rule_files | quote | trunc 0 -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
|
@ -200,13 +200,6 @@ conf:
|
|||||||
global:
|
global:
|
||||||
scrape_interval: 60s
|
scrape_interval: 60s
|
||||||
evaluation_interval: 60s
|
evaluation_interval: 60s
|
||||||
rule_files:
|
|
||||||
- /etc/config/rules/alertmanager.rules
|
|
||||||
- /etc/config/rules/etcd3.rules
|
|
||||||
- /etc/config/rules/kubernetes.rules
|
|
||||||
- /etc/config/rules/kube_apiserver.rules
|
|
||||||
- /etc/config/rules/kube_controller_manager.rules
|
|
||||||
- /etc/config/rules/kubelet.rules
|
|
||||||
scrape_configs:
|
scrape_configs:
|
||||||
- job_name: kubelet
|
- job_name: kubelet
|
||||||
scheme: https
|
scheme: https
|
||||||
|
Loading…
Reference in New Issue
Block a user