envoyproxy / go-control-plane

Go implementation of data-plane-api
Apache License 2.0
1.51k stars 509 forks source link

[warning][config] [source/extensions/config_subscription/grpc/grpc_subscription_impl.cc:130] gRPC config: initial fetch timed out for type.googleapis.com/envoy.config.route.v3.RouteConfiguration #1013

Closed jianyongniu closed 1 week ago

jianyongniu commented 1 week ago

This error only occurred when >1 routeConfig were created. The admin portal shows that there was no dynamic_route_configs created in the control plane cache.

bash-4.4# curl -s http://localhost:8001/config_dump  | jq '.configs[4].dynamic_route_configs'
null

Note that this problem occurred only when deploying multiple RouteConfigs. If only one RouteConfig is to be deployed then everything works fine.

makeRoute function:

func makeRoute(routeName, prefix, clusterName string) *route.RouteConfiguration {
    return &route.RouteConfiguration{
        Name: routeName,
        VirtualHosts: []*route.VirtualHost{{
            Name:    routeName,
            Domains: []string{"*"},
            Routes: []*route.Route{{
                Name: routeName,
                Match: &route.RouteMatch{
                    PathSpecifier: &route.RouteMatch_Prefix{
                        Prefix: prefix,
                    },
                },
                Action: &route.Route_Route{
                    Route: &route.RouteAction{
                        ClusterSpecifier: &route.RouteAction_Cluster{
                            Cluster: clusterName,
                        },
                        HostRewriteSpecifier: &route.RouteAction_AutoHostRewrite{
                            AutoHostRewrite: &wrapperspb.BoolValue{
                                Value: true,
                            },
                        },
                        Timeout: &durationpb.Duration{
                            Seconds: 30,
                        },
                        RetryPolicy: &route.RetryPolicy{
                            NumRetries: &wrapperspb.UInt32Value{
                                Value: 5,
                            },
                        },
                    },
                },
            }},
        }},
    }
}

Then in the main code, var c []types.Resource var l []types.Resource var ro []types.Resource var secrets []types.Resource

    c = append(c, makeCluster(d.ServiceName, d.Cluster.Host, d.Cluster.Port))
    ro = append(ro, makeRoute("local_route_loc_req",
        d.Cluster.Prefix,
        d.ServiceName))
    ro = append(ro, makeRoute("forward_proxy_route_stream",
        d.Cluster.Prefix,
        dynamicForwardProxyCluster))
    l = append(l, makeFowardHTTPProxyListener("forward_http_proxy_stream",
        "forward_proxy_route_stream",
        d.Listener.Host,
        d.Listener.Port,
        d.TLS))
    l = append(l, makeHTTPListener("reverse_http_proxy_loc_req",
        "local_route_loc_req",
        d.Listener.Port))
           // generate and set snapshot using resources above.
           ...
jianyongniu commented 1 week ago

Issue resolved by placing all vhost and routes under the same RouteConfiguration instance. Mark it as closed