diff --git a/prometheus/templates/configmap-etc.yaml b/prometheus/templates/configmap-etc.yaml index 5885046b4..eaa0dee29 100644 --- a/prometheus/templates/configmap-etc.yaml +++ b/prometheus/templates/configmap-etc.yaml @@ -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 }} diff --git a/prometheus/templates/statefulset.yaml b/prometheus/templates/statefulset.yaml index 46a14c2bb..8284bd8ef 100644 --- a/prometheus/templates/statefulset.yaml +++ b/prometheus/templates/statefulset.yaml @@ -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 diff --git a/prometheus/values.yaml b/prometheus/values.yaml index 0746ffa6a..0cb9220d1 100644 --- a/prometheus/values.yaml +++ b/prometheus/values.yaml @@ -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