---
#
# Copyright (C) 2019-2021 vdaas.org vald team <vald@vdaas.org>
#
# 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: vald-lb-gateway-config
  labels:
    app.kubernetes.io/name: vald
    helm.sh/chart: vald-v1.0.4
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/instance: RELEASE-NAME
    app.kubernetes.io/version: v1.0.4
    app.kubernetes.io/component: gateway-lb
data:
  config.yaml: |
    ---
    version: v0.0.0
    time_zone: UTC
    logging:
      format: raw
      level: debug
      logger: glg
    server_config:
      servers:
        - name: grpc
          host: 0.0.0.0
          port: 8081
          grpc:
            bidirectional_stream_concurrency: 20
            connection_timeout: ""
            enable_reflection: true
            header_table_size: 0
            initial_conn_window_size: 0
            initial_window_size: 0
            interceptors:
            - RecoverInterceptor
            keepalive:
              max_conn_age: ""
              max_conn_age_grace: ""
              max_conn_idle: ""
              time: ""
              timeout: ""
            max_header_list_size: 0
            max_receive_message_size: 0
            max_send_message_size: 0
            read_buffer_size: 0
            write_buffer_size: 0
          mode: GRPC
          network: tcp
          probe_wait_time: 3s
          restart: true
          socket_option:
            ip_recover_destination_addr: false
            ip_transparent: false
            reuse_addr: true
            reuse_port: true
            tcp_cork: false
            tcp_defer_accept: true
            tcp_fast_open: true
            tcp_no_delay: true
            tcp_quick_ack: true
          socket_path: ""
      health_check_servers:
        - name: liveness
          host: 0.0.0.0
          port: 3000
          http:
            handler_timeout: ""
            idle_timeout: ""
            read_header_timeout: ""
            read_timeout: ""
            shutdown_duration: 5s
            write_timeout: ""
          mode: ""
          network: tcp
          probe_wait_time: 3s
          socket_option:
            ip_recover_destination_addr: false
            ip_transparent: false
            reuse_addr: true
            reuse_port: true
            tcp_cork: false
            tcp_defer_accept: true
            tcp_fast_open: true
            tcp_no_delay: true
            tcp_quick_ack: true
          socket_path: ""
        - name: readiness
          host: 0.0.0.0
          port: 3001
          http:
            handler_timeout: ""
            idle_timeout: ""
            read_header_timeout: ""
            read_timeout: ""
            shutdown_duration: 0s
            write_timeout: ""
          mode: ""
          network: tcp
          probe_wait_time: 3s
          socket_option:
            ip_recover_destination_addr: false
            ip_transparent: false
            reuse_addr: true
            reuse_port: true
            tcp_cork: false
            tcp_defer_accept: true
            tcp_fast_open: true
            tcp_no_delay: true
            tcp_quick_ack: true
          socket_path: ""
      metrics_servers:
        - name: pprof
          host: 0.0.0.0
          port: 6060
          http:
            handler_timeout: 5s
            idle_timeout: 2s
            read_header_timeout: 1s
            read_timeout: 1s
            shutdown_duration: 5s
            write_timeout: 1s
          mode: REST
          network: tcp
          probe_wait_time: 3s
          socket_option:
            ip_recover_destination_addr: false
            ip_transparent: false
            reuse_addr: true
            reuse_port: true
            tcp_cork: false
            tcp_defer_accept: true
            tcp_fast_open: true
            tcp_no_delay: true
            tcp_quick_ack: true
          socket_path: ""
      startup_strategy:
        - liveness
        - pprof
        - grpc
        - readiness
      full_shutdown_duration: 600s
      tls:
        ca: /path/to/ca
        cert: /path/to/cert
        enabled: false
        insecure_skip_verify: false
        key: /path/to/key
    observability:
      enabled: false
      collector:
        duration: 5s
        metrics:
          enable_cgo: true
          enable_goroutine: true
          enable_memory: true
          enable_version_info: true
          version_info_labels:
          - vald_version
          - server_name
          - git_commit
          - build_time
          - go_version
          - go_os
          - go_arch
          - ngt_version
      trace:
        enabled: false
        sampling_rate: 1
      prometheus:
        enabled: false
        endpoint: /metrics
        namespace: vald
      jaeger:
        enabled: false
        collector_endpoint: ""
        agent_endpoint: "jaeger-agent.default.svc.cluster.local:6831"
        username: ""
        password: ""
        service_name: "vald-lb-gateway"
        buffer_max_count: 10
      stackdriver:
        project_id: ""
        client:
          api_key: ""
          audiences: []
          authentication_enabled: true
          credentials_file: ""
          credentials_json: ""
          endpoint: ""
          quota_project: ""
          request_reason: ""
          scopes: []
          telemetry_enabled: true
          user_agent: ""
        exporter:
          bundle_count_threshold: 0
          bundle_delay_threshold: "0"
          location: ""
          metric_prefix: vald.vdaas.org
          monitoring_enabled: false
          number_of_workers: 1
          reporting_interval: 1m
          skip_cmd: false
          timeout: 5s
          trace_spans_buffer_max_bytes: 0
          tracing_enabled: false
        profiler:
          enabled: false
          service: "vald-lb-gateway"
          service_version: ""
          debug_logging: false
          mutex_profiling: true
          cpu_profiling: true
          alloc_profiling: true
          heap_profiling: true
          goroutine_profiling: true
          alloc_force_gc: false
          api_addr: ""
          instance: ""
          zone: ""
    gateway:
      agent_port: 8081
      agent_name: "vald-agent-ngt"
      agent_dns: vald-agent-ngt.default.svc.cluster.local
      agent_namespace: "_MY_POD_NAMESPACE_"
      node_name: ""
      index_replica: 5
      discoverer:
        duration: 200ms
        client:
          addrs:
            - vald-discoverer.default.svc.cluster.local:8081
          health_check_duration: "1s"
          connection_pool:
            enable_dns_resolver: true
            enable_rebalance: true
            old_conn_close_duration: 3s
            rebalance_duration: 30m
            size: 3
          backoff:
            backoff_factor: 1.1
            backoff_time_limit: 5s
            enable_error_log: true
            initial_duration: 5ms
            jitter_limit: 100ms
            maximum_duration: 5s
            retry_count: 100
          call_option:
            max_recv_msg_size: 0
            max_retry_rpc_buffer_size: 0
            max_send_msg_size: 0
            wait_for_ready: true
          dial_option:
            backoff_base_delay: 1s
            backoff_jitter: 0.2
            backoff_max_delay: 120s
            backoff_multiplier: 1.6
            enable_backoff: false
            initial_connection_window_size: 0
            initial_window_size: 0
            insecure: true
            keep_alive:
              permit_without_stream: false
              time: ""
              timeout: ""
            max_msg_size: 0
            min_connection_timeout: 20s
            net:
              dialer:
                dual_stack_enabled: true
                keep_alive: ""
                timeout: ""
              dns:
                cache_enabled: true
                cache_expiration: 1h
                refresh_duration: 30m
              socket_option:
                ip_recover_destination_addr: false
                ip_transparent: false
                reuse_addr: true
                reuse_port: true
                tcp_cork: false
                tcp_defer_accept: true
                tcp_fast_open: true
                tcp_no_delay: true
                tcp_quick_ack: true
              tls:
                ca: /path/to/ca
                cert: /path/to/cert
                enabled: false
                insecure_skip_verify: false
                key: /path/to/key
            read_buffer_size: 0
            timeout: ""
            write_buffer_size: 0
          tls:
            ca: /path/to/ca
            cert: /path/to/cert
            enabled: false
            insecure_skip_verify: false
            key: /path/to/key
        agent_client_options:
          addrs: []
          health_check_duration: "1s"
          connection_pool:
            enable_dns_resolver: true
            enable_rebalance: true
            old_conn_close_duration: 3s
            rebalance_duration: 30m
            size: 3
          backoff:
            backoff_factor: 1.1
            backoff_time_limit: 5s
            enable_error_log: true
            initial_duration: 5ms
            jitter_limit: 100ms
            maximum_duration: 5s
            retry_count: 100
          call_option:
            max_recv_msg_size: 0
            max_retry_rpc_buffer_size: 0
            max_send_msg_size: 0
            wait_for_ready: true
          dial_option:
            backoff_base_delay: 1s
            backoff_jitter: 0.2
            backoff_max_delay: 120s
            backoff_multiplier: 1.6
            enable_backoff: false
            initial_connection_window_size: 0
            initial_window_size: 0
            insecure: true
            keep_alive:
              permit_without_stream: false
              time: ""
              timeout: ""
            max_msg_size: 0
            min_connection_timeout: 20s
            net:
              dialer:
                dual_stack_enabled: true
                keep_alive: ""
                timeout: ""
              dns:
                cache_enabled: true
                cache_expiration: 1h
                refresh_duration: 30m
              socket_option:
                ip_recover_destination_addr: false
                ip_transparent: false
                reuse_addr: true
                reuse_port: true
                tcp_cork: false
                tcp_defer_accept: true
                tcp_fast_open: true
                tcp_no_delay: true
                tcp_quick_ack: true
              tls:
                ca: /path/to/ca
                cert: /path/to/cert
                enabled: false
                insecure_skip_verify: false
                key: /path/to/key
            read_buffer_size: 0
            timeout: ""
            write_buffer_size: 0
          tls:
            ca: /path/to/ca
            cert: /path/to/cert
            enabled: false
            insecure_skip_verify: false
            key: /path/to/key
