---
apiVersion: v1
kind: ConfigMap
metadata:
  name: repo-configmap
data:
  rsyncd.conf: |
    log file = /dev/stdout
    use chroot = yes
    uid = root
    gid = root
    max connections = 10
    timeout = 600
    read only = yes

    [mindspore]
            path = /repo/mindspore
            comment = mindspore repo folder
            read only = true
            auth users = root
            secrets file = /etc/rsyncd.secrets
            ignore nonreadable = yes
            refuse options = checksum
            dont compress = *
  ssh.pub: |
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQChSk+/FF79F8ut0hpNuYQ4uhAgUSY4hzRIPvQ2uVTukP0B0A99NYPfDNICp7gLa6e7yzaj+bvCpgWZoZCNAWTBWkq+zHTgDDHrLtUE4zPC1guzuR+Gz3yeIzSt0iAzi9uG2p+qh7jUfl8QAwNOs3wosNenoZj7NmgsCF9M1o85msimRc8Roxnn5caao1RtdNkDHDqhw5QiS9doSUjoxT+esD0CI7RHAyMgMCfSlXXl/phpdSU2hVJSFXsHVBTiymkuMQe8Ylmls+OEmCe8Cy7lIqE/Q+56l62Pxv4UJpOWs9T/SrOEr5vtEPGghZzgo5ViewzAs3dGMaODSO25XhrIiRZ7hjBK9tjLOX7ZXfAsb4DpJljq2aPCrlEaGJsHc2laixKIOKogDbqFffM3eXwgEAxPUevX/mYnuyhAVrsRUl8HXIQnTuVIEeYVdmn2MA8I/y6MPWdN5VbLR5gOiNLOuSVhCq3sQLpTZ9CONF+zq+1layCoaGMIZw5JwYgWCQgCGNclbx8eMVY3+J3slH6VjzE/05Eys18HtpuAMCivBLGgpBGeCVdpQqkHodTn5ZjNZEBAgzHypiOgR/txMHhkTi4+1ZvTmSRWs9hggv4/IcDQFaj1f2JVds6lxGvJyOnoy9k1VUC0q4N6sptpJ/n+ElCJ4UaHE48La3Mu79R6+Q== mindspore_hosts
  default.conf: |
    server {
        listen 80;

        if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {
               set $year $1;
               set $month $2;
               set $day $3;
        }
        access_log /var/log/nginx/access.log.$year$month$day main;

        server_name download.mindspore.cn;
        location / {
            root   /repo/mindspore;
            fancyindex on;
            fancyindex_exact_size off;
            fancyindex_localtime on;
            autoindex   on;
        }
        location = /favicon.ico {
          log_not_found off;
          access_log off;
        }
    }
  nginx.conf: |-
    user  root;
    worker_processes  auto;

    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;


    events {
        worker_connections  1024;
    }


    http {
        include       /etc/nginx/conf/mime.types;
        default_type  application/octet-stream;

        # used for geoip2
        geoip2 /etc/nginx/geoip/country/GeoLite2-Country.mmdb {
            $geoip2_metadata_country_build metadata build_epoch;
            $geoip2_data_country_code default=US source=$remote_addr country iso_code;
            $geoip2_data_country_name country names en;
        }

        geoip2 /etc/nginx/geoip/city/GeoLite2-City.mmdb {
            $geoip2_data_city_name default=ShenZhen city names en;
            $geoip2_data_location_latitude location latitude;
            $geoip2_data_location_longitude location longitude;
        }

        # the cidr used for elb cluster
        set_real_ip_from 100.125.0.0/16;
        real_ip_recursive on;
        real_ip_header X-Forwarded-For;

        log_format  main  '$remote_addr <$geoip2_data_country_code, $geoip2_data_country_name, $geoip2_data_city_name, $geoip2_data_location_latitude, $geoip2_data_location_longitude> '
                          '[$time_local] "$request" $status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" $request_filename';

        sendfile        on;
        tcp_nopush      on;

        keepalive_timeout  65;

        #gzip  on;

        include /etc/nginx/conf/conf.d/*.conf;
    }
