{{- if .Values.nginx.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "prometheus-benchmark.fullname" . }}-nginx-cm
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "prometheus-benchmark.labels" . | nindent 4 }}
data:
  nginx.conf: |
    daemon off;
    worker_processes auto;
    pid /tmp/nginx.pid;
    events {
      worker_connections 300;
    }
    http {
      proxy_cache_path /tmp/nginx/client_temp keys_zone=all:1m max_size=10m;
      client_body_temp_path /tmp/nginx 1 2;
      proxy_temp_path /tmp/nginx 1 2;
      fastcgi_temp_path /tmp/nginx 1 2;
      uwsgi_temp_path /tmp/nginx 1 2;
      scgi_temp_path /tmp/nginx 1 2;
      upstream nodeexporter {
        server 127.0.0.1:9101;
        keepalive 1000;
      }
      server {
        listen 127.0.0.1:9102;
        server_name foo;
        access_log off;
        error_log off;
        keepalive_disable none;
        location / {
          proxy_pass http://nodeexporter/;
          proxy_http_version 1.1;
          proxy_set_header Connection "";
          proxy_cache all;
          proxy_cache_lock on;
          proxy_cache_valid 1s;
          proxy_cache_background_update on;
          proxy_cache_use_stale updating;
      }
    }
    }
{{ end }}
