Get dns autodiscovery from reclass
Change-Id: I8850be1a118662ebf75a3e0fc2540691ab027220
diff --git a/README.rst b/README.rst
index 627a517..02a3941 100644
--- a/README.rst
+++ b/README.rst
@@ -24,12 +24,29 @@
address: 0.0.0.0
external_port: 15010
target:
+ dns:
+ - name: 'pushgateway'
+ domain:
+ - 'tasks.prometheus_pushgateway'
+ type: A
+ port: 9091
+ - name: 'prometheus'
+ domain:
+ - 'tasks.prometheus_server'
+ type: A
+ port: 9090
kubernetes:
- api_ip: 127.0.0.1
+ api_ip: ${_param:kubernetes_control_address}
ssl_dir: /opt/prometheus/config
cert_name: kubelet-client.crt
key_name: kubelet-client.key
- etcd: ${etcd:server:members}
+ etcd:
+ - host: ${_param:cluster_node01_address}
+ port: ${_param:cluster_node01_port}
+ - host: ${_param:cluster_node02_address}
+ port: ${_param:cluster_node02_port}
+ - host: ${_param:cluster_node03_address}
+ port: ${_param:cluster_node03_port}
recording:
- name: 'instance:fd_utilization'
query: >-
diff --git a/prometheus/files/prometheus.yml b/prometheus/files/prometheus.yml
index 0872c02..5e33576 100644
--- a/prometheus/files/prometheus.yml
+++ b/prometheus/files/prometheus.yml
@@ -25,7 +25,7 @@
- targets: [{{ telegraf_nodes | join(',') }}]
{%- endif %}
-{% if server.get('target', {}).etcd is defined %}
+{% if server.get('target', {}).get('etcd') %}
{%- set etcd_nodes = [] %}
{%- for node in server.target.etcd %}
{%- set etcd_address = "'%s:%d'" | format(node.host, node.port) %}
@@ -38,7 +38,7 @@
{%- endif %}
{%- endif %}
-{% if server.get('target', {}).kubernetes is defined %}
+{% if server.get('target', {}).get('kubernetes') %}
- job_name: 'kubernetes-api'
scheme: https
tls_config:
@@ -158,18 +158,13 @@
target_label: kubernetes_pod_name
{%- endif %}
-
- - job_name: 'pushgateway'
+{%- for target in server.get('target', {}).get('dns', []) %}
+ - job_name: {{ target.name }}
dns_sd_configs:
- names:
- - 'tasks.pushgateway'
- type: 'A'
- port: 9091
-
-
- - job_name: 'prometheus'
- dns_sd_configs:
- - names:
- - 'tasks.prometheus'
- type: 'A'
- port: {{ server.bind.port }}
+ {%- for domain in target.domain %}
+ - {{ domain }}
+ {%- endfor %}
+ type: {{ target.type }}
+ port: {{ target.port }}
+{%- endfor %}