From 0c746269f2ccdb6616b5a40d1f47426bc0776f2b Mon Sep 17 00:00:00 2001 From: "solen.bellouati" Date: Mon, 19 Feb 2024 11:25:37 +0100 Subject: [PATCH] grafana-prometheus - add withelists on grafana et prometheus from traefik --- templates/compose/grafana-prometheus.yml.j2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/compose/grafana-prometheus.yml.j2 b/templates/compose/grafana-prometheus.yml.j2 index 6176ca2..c44e742 100644 --- a/templates/compose/grafana-prometheus.yml.j2 +++ b/templates/compose/grafana-prometheus.yml.j2 @@ -66,6 +66,10 @@ services: traefik.http.routers.grafana.tls.certresolver: letsencrypt traefik.http.routers.grafana.entrypoints: "{{ grafana_traefik_entrypoint }}" traefik.http.services.grafana.loadbalancer.server.port: 3000 +{% else %} +{% if grafana_traefik_ipwhitelist is defined %} + traefik.http.middlewares.grafana-clientips.ipwhitelist.sourcerange: {{ grafana_traefik_ipwhitelist }} + traefik.http.routers.grafana.middlewares: "grafana-clientips@docker" {% else %} ports: - "{{ grafana_port | default(3000) }}:3000" @@ -95,6 +99,10 @@ services: traefik.http.routers.prometheus.tls.certresolver: letsencrypt traefik.http.routers.prometheus.entrypoints: "{{ grafana_traefik_entrypoint }}" traefik.http.services.prometheus.loadbalancer.server.port: 9090 +{% else %} +{% if prometheus_traefik_ipwhitelist is defined %} + traefik.http.middlewares.prometheus-clientips.ipwhitelist.sourcerange: {{ prometheus_traefik_ipwhitelist }} + traefik.http.routers.prometheus.middlewares: "prometheus-clientips@docker" {% else %} ports: - "{{ prometheus_port | default(9090) }}:9090"