apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-files
  namespace: infra
  labels:
    name: nginx-files
    namespace: infra
data:
  nginx.conf: |
    events {
      worker_connections  1024;
    }

    http {
      sendfile    on;
      tcp_nopush  on;
      tcp_nodelay on;

      keepalive_timeout     60;
      types_hash_max_size   2048;
      client_max_body_size  100m;

      include       mime.types;
      default_type  application/octet-stream;
      access_log    /var/log/nginx/access.log;
      error_log     /var/log/nginx/error.log;

      gzip                on;
      gzip_vary           on;
      gzip_proxied        any;
      gzip_comp_level     6;
      gzip_buffers 16     8k;
      gzip_http_version   1.1;
      gzip_types          text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

      upstream k8s {
        server kubernetes-dashboard.kube-system:80;
      }


        server {
          listen    443 ssl;
          listen    [::]:443 ssl;
          root      /usr/shar/nginx/html;

          ssl on;
          ssl_certificate       "/etc/nginx/cert/cert.pem";
          ssl_certificate_key   "/etc/nginx/cert/cert.pem";

          ssl_session_cache shared:SSL:1m;
          ssl_session_timeout 10m;
          ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
          ssl_ciphers HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP;
          ssl_prefer_server_ciphers on;

          server_name   ~^chronograf[.].*$;

          location / {
            resolver            kube-dns.kube-system valid=1s;
            set $server         chronograf.data.svc.cluster.local:8888;
            rewrite             ^/(.*) /$1 break;
            proxy_pass          http://$server;
            proxy_set_header    Host $host;
            proxy_set_header    X-Real-IP $remote_addr;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header    X-Forwarded-Proto $scheme;
          }
        }


        server {
          listen    443 ssl;
          listen    [::]:443 ssl;
          root      /usr/shar/nginx/html;

          ssl on;
          ssl_certificate       "/etc/nginx/cert/cert.pem";
          ssl_certificate_key   "/etc/nginx/cert/cert.pem";

          ssl_session_cache shared:SSL:1m;
          ssl_session_timeout 10m;
          ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
          ssl_ciphers HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP;
          ssl_prefer_server_ciphers on;

          server_name   ~^influxdb[.].*$;

          location / {
            resolver            kube-dns.kube-system valid=1s;
            set $server         influxdb.data.svc.cluster.local:8086;
            rewrite             ^/(.*) /$1 break;
            proxy_pass          http://$server;
            proxy_set_header    Host $host;
            proxy_set_header    X-Real-IP $remote_addr;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header    X-Forwarded-Proto $scheme;
          }
        }


        server {
          listen    443 ssl;
          listen    [::]:443 ssl;
          root      /usr/shar/nginx/html;

          ssl on;
          ssl_certificate       "/etc/nginx/cert/cert.pem";
          ssl_certificate_key   "/etc/nginx/cert/cert.pem";

          ssl_session_cache shared:SSL:1m;
          ssl_session_timeout 10m;
          ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
          ssl_ciphers HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP;
          ssl_prefer_server_ciphers on;

          server_name   ~^kapacitor[.].*$;

          location / {
            resolver            kube-dns.kube-system valid=1s;
            set $server         kapacitor.data.svc.cluster.local:9092;
            rewrite             ^/(.*) /$1 break;
            proxy_pass          http://$server;
            proxy_set_header    Host $host;
            proxy_set_header    X-Real-IP $remote_addr;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header    X-Forwarded-Proto $scheme;
          }
        }
    }
  mime.types: |-
    types {
        text/html                             html htm shtml;
        text/css                              css;
        text/xml                              xml;
        image/gif                             gif;
        image/jpeg                            jpeg jpg;
        application/x-javascript              js;
        application/atom+xml                  atom;
        application/rss+xml                   rss;

        text/mathml                           mml;
        text/plain                            txt;
        text/vnd.sun.j2me.app-descriptor      jad;
        text/vnd.wap.wml                      wml;
        text/x-component                      htc;

        image/png                             png;
        image/tiff                            tif tiff;
        image/vnd.wap.wbmp                    wbmp;
        image/x-icon                          ico;
        image/x-jng                           jng;
        image/x-ms-bmp                        bmp;
        image/svg+xml                         svg svgz;
        image/webp                            webp;

        application/java-archive              jar war ear;
        application/mac-binhex40              hqx;
        application/msword                    doc;
        application/pdf                       pdf;
        application/postscript                ps eps ai;
        application/rtf                       rtf;
        application/vnd.ms-excel              xls;
        application/vnd.ms-powerpoint         ppt;
        application/vnd.wap.wmlc              wmlc;
        application/vnd.google-earth.kml+xml  kml;
        application/vnd.google-earth.kmz      kmz;
        application/x-7z-compressed           7z;
        application/x-cocoa                   cco;
        application/x-java-archive-diff       jardiff;
        application/x-java-jnlp-file          jnlp;
        application/x-makeself                run;
        application/x-perl                    pl pm;
        application/x-pilot                   prc pdb;
        application/x-rar-compressed          rar;
        application/x-redhat-package-manager  rpm;
        application/x-sea                     sea;
        application/x-shockwave-flash         swf;
        application/x-stuffit                 sit;
        application/x-tcl                     tcl tk;
        application/x-x509-ca-cert            der pem crt;
        application/x-xpinstall               xpi;
        application/xhtml+xml                 xhtml;
        application/zip                       zip;

        application/octet-stream              bin exe dll;
        application/octet-stream              deb;
        application/octet-stream              dmg;
        application/octet-stream              eot;
        application/octet-stream              iso img;
        application/octet-stream              msi msp msm;

        audio/midi                            mid midi kar;
        audio/mpeg                            mp3;
        audio/ogg                             ogg;
        audio/x-m4a                           m4a;
        audio/x-realaudio                     ra;

        video/3gpp                            3gpp 3gp;
        video/mp4                             mp4;
        video/mpeg                            mpeg mpg;
        video/quicktime                       mov;
        video/webm                            webm;
        video/x-flv                           flv;
        video/x-m4v                           m4v;
        video/x-mng                           mng;
        video/x-ms-asf                        asx asf;
        video/x-ms-wmv                        wmv;
        video/x-msvideo                       avi;
    }
