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 address: 0.0.0.0
external_port: 15010 external_port: 15010
target: target:
dns:
- name: 'pushgateway'
domain:
- 'tasks.prometheus_pushgateway'
type: A
port: 9091
- name: 'prometheus'
domain:
- 'tasks.prometheus_server'
type: A
port: 9090
kubernetes: kubernetes:
api_ip: 127.0.0.1 api_ip: ${_param:kubernetes_control_address}
ssl_dir: /opt/prometheus/config ssl_dir: /opt/prometheus/config
cert_name: kubelet-client.crt cert_name: kubelet-client.crt
key_name: kubelet-client.key 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: recording:
- name: 'instance:fd_utilization' - name: 'instance:fd_utilization'
query: >- query: >-

View file

@ -25,7 +25,7 @@ scrape_configs:
- targets: [{{ telegraf_nodes | join(',') }}] - targets: [{{ telegraf_nodes | join(',') }}]
{%- endif %} {%- endif %}
{% if server.get('target', {}).etcd is defined %} {% if server.get('target', {}).get('etcd') %}
{%- set etcd_nodes = [] %} {%- set etcd_nodes = [] %}
{%- for node in server.target.etcd %} {%- for node in server.target.etcd %}
{%- set etcd_address = "'%s:%d'" | format(node.host, node.port) %} {%- set etcd_address = "'%s:%d'" | format(node.host, node.port) %}
@ -38,7 +38,7 @@ scrape_configs:
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{% if server.get('target', {}).kubernetes is defined %} {% if server.get('target', {}).get('kubernetes') %}
- job_name: 'kubernetes-api' - job_name: 'kubernetes-api'
scheme: https scheme: https
tls_config: tls_config:
@ -158,18 +158,13 @@ scrape_configs:
target_label: kubernetes_pod_name target_label: kubernetes_pod_name
{%- endif %} {%- endif %}
{%- for target in server.get('target', {}).get('dns', []) %}
- job_name: 'pushgateway' - job_name: {{ target.name }}
dns_sd_configs: dns_sd_configs:
- names: - names:
- 'tasks.pushgateway' {%- for domain in target.domain %}
type: 'A' - {{ domain }}
port: 9091 {%- endfor %}
type: {{ target.type }}
port: {{ target.port }}
- job_name: 'prometheus' {%- endfor %}
dns_sd_configs:
- names:
- 'tasks.prometheus'
type: 'A'
port: {{ server.bind.port }}