Add rules files to prometheus dynamically
This dynamically adds the rules files for prometheus to the prometheus-etc configmap, and also dynamically adds volume mounts to the prometheus statefulset for each rules file This also removes the empty rules file trees in the prometheus values.yaml file Change-Id: I9acbbe57d71a23f69e9e172b2f3ad66985e99574
This commit is contained in:
parent
457ff9552b
commit
a153f5474f
@ -24,26 +24,8 @@ metadata:
|
||||
data:
|
||||
prometheus.yml: |+
|
||||
{{ toYaml .Values.conf.prometheus.scrape_configs | indent 4 }}
|
||||
alertmanager.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.alertmanager | indent 4 }}
|
||||
etcd3.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.etcd3 | indent 4 }}
|
||||
kube-apiserver.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.kube_apiserver | indent 4 }}
|
||||
kube-controller-manager.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.kube_controller_manager | indent 4 }}
|
||||
kubelet.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.kubelet | indent 4 }}
|
||||
kubernetes.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.kubernetes | indent 4 }}
|
||||
rabbitmq.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.rabbitmq | indent 4 }}
|
||||
mysql.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.mysql | indent 4 }}
|
||||
ceph.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.ceph | indent 4 }}
|
||||
openstack.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.openstack | indent 4 }}
|
||||
custom.rules: |+
|
||||
{{ toYaml .Values.conf.prometheus.rules.custom | indent 4 }}
|
||||
{{ range $key, $value := .Values.conf.prometheus.rules }}
|
||||
{{ $key }}.rules: |+
|
||||
{{ toYaml $value | indent 4 }}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
|
@ -92,50 +92,12 @@ spec:
|
||||
mountPath: /etc/config
|
||||
- name: rulesprometheus
|
||||
mountPath: /etc/config/rules
|
||||
{{- range $key, $value := .Values.conf.prometheus.rules }}
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/alertmanager.rules
|
||||
subPath: alertmanager.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/etcd3.rules
|
||||
subPath: etcd3.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/kubernetes.rules
|
||||
subPath: kubernetes.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/kube-apiserver.rules
|
||||
subPath: kube-apiserver.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/kube-controller-manager.rules
|
||||
subPath: kube-controller-manager.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/kubelet.rules
|
||||
subPath: kubelet.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/rabbitmq.rules
|
||||
subPath: rabbitmq.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/mysql.rules
|
||||
subPath: mysql.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/ceph.rules
|
||||
subPath: ceph.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/openstack.rules
|
||||
subPath: openstack.rules
|
||||
readOnly: true
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/rules/custom.rules
|
||||
subPath: custom.rules
|
||||
mountPath: /etc/config/rules/{{ $key }}.rules
|
||||
subPath: {{ $key }}.rules
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
- name: prometheus-etc
|
||||
mountPath: /etc/config/prometheus.yml
|
||||
subPath: prometheus.yml
|
||||
|
@ -207,15 +207,9 @@ conf:
|
||||
- /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/kube_apiserver.rules
|
||||
- /etc/config/rules/kube_controller_manager.rules
|
||||
- /etc/config/rules/kubelet.rules
|
||||
- /etc/config/rules/kube-scheduler.rules
|
||||
- /etc/config/rules/rabbitmq.rules
|
||||
- /etc/config/rules/mysql.rules
|
||||
- /etc/config/rules/ceph.rules
|
||||
- /etc/config/rules/openstack.rules
|
||||
- /etc/config/rules/custom.rules
|
||||
scrape_configs:
|
||||
- job_name: kubelet
|
||||
scheme: https
|
||||
@ -768,8 +762,3 @@ conf:
|
||||
expr: histogram_quantile(0.5, sum(scheduler_binding_latency_microseconds_bucket) BY (le, cluster)) / 1e+06
|
||||
labels:
|
||||
quantile: "0.5"
|
||||
rabbitmq: null
|
||||
mysql: null
|
||||
ceph: null
|
||||
openstack: null
|
||||
custom: null
|
||||
|
Loading…
Reference in New Issue
Block a user