Get dns autodiscovery from reclass

Change-Id: I8850be1a118662ebf75a3e0fc2540691ab027220
This commit is contained in:
Bartosz Kupidura 2017-03-29 19:19:34 +02:00
parent 597b0678bf
commit 8642002cf8
2 changed files with 29 additions and 17 deletions

View file

@ -24,12 +24,29 @@ Configure prometheus server
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: >-

View file

@ -25,7 +25,7 @@ scrape_configs:
- 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 @@ scrape_configs:
{%- 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 @@ scrape_configs:
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 %}