#
# Copyright (C) 2019 Vdaas.org Vald team ( kpango, kmrmt, rinx )
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
apiVersion: v1
kind: ConfigMap
metadata:
  name: gateway-config
data:
  config.yaml: |
    ---
    version: v0.0.0
    server_config:
      servers:
      - name: gateway-rest
        host: 0.0.0.0
        port: 8080
        mode: REST
        probe_wait_time: 3s
        http:
          shutdown_duration: 5s
          handler_timeout: 5s
          idle_timeout: 2s
          read_header_timeout: 1s
          read_timeout: 1s
          write_timeout: 1s
      - name: gateway-grpc
        host: 0.0.0.0
        port: 8081
        mode: GRPC
        probe_wait_time: "3s"
        grpc:
          max_receive_message_size: 0
          max_send_message_size: 0
          initial_window_size: 0
          initial_conn_window_size: 0
          keepalive:
            max_idle_conn_idle: O
            max_conn_age: ""
            max_conn_age_grace: ""
            time: ""
            timeout: ""
          write_buffer_size: 0
          read_buffer_size: 0
          connection_timeout: ""
          max_header_list_size: 0
          header_table_size: 0
          interceptors: []
        restart: true
      health_check_servers:
      - name: liveness
        host: 0.0.0.0
        port: 3000
        mode: ""
        probe_wait_time: "3s"
        http:
          shutdown_duration: "5s"
          handler_timeout: ""
          idle_timeout: ""
          read_header_timeout: ""
          read_timeout: ""
          write_timeout: ""
      - name: readiness
        host: 0.0.0.0
        port: 3001
        mode: ""
        probe_wait_time: "3s"
        http:
          shutdown_duration: "5s"
          handler_timeout: ""
          idle_timeout: ""
          read_header_timeout: ""
          read_timeout: ""
          write_timeout: ""
      metrics_servers:
      - name: pprof
        host: 0.0.0.0
        port: 6060
        mode: REST
        probe_wait_time: 3s
        http:
          shutdown_duration: 5s
          handler_timeout: 5s
          idle_timeout: 2s
          read_header_timeout: 1s
          read_timeout: 1s
          write_timeout: 1s
      startup_strategy:
      - livenesss
      - pprof
      - gateway-grpc
      - gateway-rest
      - readiness
      shutdown_strategy:
      - readiness
      - gateway-rest
      - gateway-grpc
      - pprof
      - livenesss
      full_shutdown_duration: 600s
      tls:
        enabled: false
        cert: /path/to/cert
        key: /path/to/key
        ca: /path/to/ca
    gateway:
      agent_port: 8082
      agent_name: agent-ngt
      agent_dns: agent-ngt.default.svc.cluster.local
      index_replica: 5
      discoverer:
        host: discoverer-k8s.default.svc.cluster.local
        port: 8081
        duration: "5s"
        discover_client:
          addrs: []
          health_check_duration: "5s"
          backoff:
            initial_duration: "5ms"
            backoff_time_limit: "5s"
            maximum_duration: "1s"
            jitter_limit: "100ms"
            backoff_factor: 1.2
            retry_count: 20
            enable_error_log: true
          call_option:
            wait_for_ready: true
            max_retry_rpc_buffer_size: 0
            max_recv_msg_size: 0
            max_send_msg_size: 0
          dial_option:
            write_buffer_size: 0
            read_buffer_size: 0
            initial_window_size: 0
            initial_connection_window_size: 0
            max_msg_size: 0
            max_backoff_delay: ""
            enable_backoff: false
            insecure: true
            timeout: ""
            dialer:
              dns:
                cache_enabled: false
                refresh_duration: ""
                cache_expiration: ""
              dialer:
                timeout: ""
                keep_alive: ""
                dual_stack_enabled: true
              tls:
                enabled: false
                cert: /path/to/cert
                key: /path/to/key
                ca: /path/to/ca
            keep_alive:
              time: ""
              timeout: ""
              permit_without_stream: false
          tls:
            enabled: false
            cert: /path/to/cert
            key: /path/to/key
            ca: /path/to/ca
        agent_client:
          addrs: []
          health_check_duration: "5s"
          backoff:
            initial_duration: "1ms"
            backoff_time_limit: "5s"
            maximum_duration: "1s"
            jitter_limit: "100ms"
            backoff_factor: 1.2
            retry_count: 20
            enable_error_log: true
          call_option:
            wait_for_ready: true
            max_retry_rpc_buffer_size: 0
            max_recv_msg_size: 0
            max_send_msg_size: 0
          dial_option:
            write_buffer_size: 0
            read_buffer_size: 0
            initial_window_size: 0
            initial_connection_window_size: 0
            max_msg_size: 0
            max_backoff_delay: ""
            enable_backoff: false
            insecure: true
            timeout: ""
            dialer:
              dns:
                cache_enabled: true
                refresh_duration: "5s"
                cache_expiration: "24h"
              dialer:
                timeout: ""
                keep_alive: ""
                dual_stack_enabled: true
              tls:
                enabled: false
                cert: /path/to/cert
                key: /path/to/key
                ca: /path/to/ca
            keep_alive:
              time: "60s"
              timeout: ""
              permit_without_stream: false
          tls:
            enabled: false
            cert: /path/to/cert
            key: /path/to/key
            ca: /path/to/ca
      meta:
        host: meta-redis.default.svc.cluster.local
        port: 8081
        client:
          addrs: []
          health_check_duration: "5s"
          backoff:
            initial_duration: "5ms"
            backoff_time_limit: "5s"
            maximum_duration: "1s"
            jitter_limit: "100ms"
            backoff_factor: 1.2
            retry_count: 20
            enable_error_log: true
          call_option:
            wait_for_ready: true
            max_retry_rpc_buffer_size: 0
            max_recv_msg_size: 0
            max_send_msg_size: 0
          dial_option:
            write_buffer_size: 0
            read_buffer_size: 0
            initial_window_size: 0
            initial_connection_window_size: 0
            max_msg_size: 0
            max_backoff_delay: ""
            enable_backoff: false
            insecure: true
            timeout: ""
            dialer:
              dns:
                cache_enabled: true
                refresh_duration: "5s"
                cache_expiration: "12h"
              dialer:
                timeout: ""
                keep_alive: ""
                dual_stack_enabled: true
              tls:
                enabled: false
                cert: /path/to/cert
                key: /path/to/key
                ca: /path/to/ca
            keep_alive:
              time: "60s"
              timeout: ""
              permit_without_stream: false
          tls:
            enabled: false
            cert: /path/to/cert
            key: /path/to/key
            ca: /path/to/ca
      backup:
        host: manager-backup-mysql.default.svc.cluster.local
        port: 8081
        client:
          addrs: []
          health_check_duration: "5s"
          backoff:
            initial_duration: "5ms"
            backoff_time_limit: "5s"
            maximum_duration: "1s"
            jitter_limit: "100ms"
            backoff_factor: 1.2
            retry_count: 20
            enable_error_log: true
          call_option:
            wait_for_ready: true
            max_retry_rpc_buffer_size: 0
            max_recv_msg_size: 0
            max_send_msg_size: 0
          dial_option:
            write_buffer_size: 0
            read_buffer_size: 0
            initial_window_size: 0
            initial_connection_window_size: 0
            max_msg_size: 0
            max_backoff_delay: ""
            enable_backoff: false
            insecure: true
            timeout: ""
            dialer:
              dns:
                cache_enabled: false
                refresh_duration: ""
                cache_expiration: ""
              dialer:
                timeout: ""
                keep_alive: ""
                dual_stack_enabled: true
              tls:
                enabled: false
                cert: /path/to/cert
                key: /path/to/key
                ca: /path/to/ca
            keep_alive:
              time: "60s"
              timeout: ""
              permit_without_stream: false
          tls:
            enabled: false
            cert: /path/to/cert
            key: /path/to/key
            ca: /path/to/ca
      egress_filter:
        client: null
