如何在 Envoy 中禁用路由超时?

How to disable route timeout in Envoy?

我正在尝试使用 http2/grpc 流式传输,但我的连接在 15 秒后断开。 documentation on the timeout 设置表示将超时设置为 0。但是,当我这样做时,Envoy 在启动时抛出错误,抱怨 0 不是 Duration 类型的有效值。

如何禁用路由超时?

这是我的 Envoy 配置 .yml

    admin:
      access_log_path: "/dev/null"
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 8801
    
    static_resources:
      listeners:
      - address:
          socket_address:
            address: 0.0.0.0
            port_value: 11001
        filter_chains:
        - filters:
          - name: envoy.filters.network.http_connection_manager
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
              stat_prefix: ingress_http
              http_filters:
              - name: envoy.filters.http.router
              route_config:
                name: grpc_route
                virtual_hosts:
                - name: grpc_service
                  domains: ["*"]
                  routes:
                  - name: grpc_proxy
                    match:
                      prefix: "/"
                    route:
                      timeout: 0 # How do I disable the timeout?
                      auto_host_rewrite: true
                      prefix_rewrite: "/"
                      cluster: grpc

      clusters:
      - name: grpc
        connect_timeout: 0.25s
        type: STRICT_DNS
        lb_policy: round_robin
        http2_protocol_options: {}
        dns_lookup_family: V4_ONLY
        load_assignment:
          cluster_name: grpc
          endpoints:
          - lb_endpoints:
            - endpoint:
                address: 
                  socket_address: 
                    address: mygrpcservice
                    port_value: 50061 

你差不多明白了。您需要做的唯一更改是从整数变为持续时间。因此,您需要为零秒指定“0s”而不是“0”。

我通过在你的 config.yaml 中设置 timeout: 0s 验证了这一点,一切都启动了。