cluster-level config for network/http filters
Title: Sending cluster-level config for filters by CDS or RTDS?
Description:
Our data-plane is deployed as an egress sidecar and we need to migrate some features from our SDK, such as degradation. We're planning to implement them in some filters, including the Redis filter and our own http filters. Some features are cluster-level but Envoy doesn't have a per-cluster config for filters. We presented two solutions:
- extending
cluster.protowithtyped_per_filter_configfield and sending it by CDS. But it seems that cluster updating will result in re-connection to all endpoints. It may cause some serious problems in our system. - Using runtime features which keys are correlated with the cluster and sending it by RTDS. But runtime only supports basic value types(Integer, Boolean, Double, and String) and our cluster-level config is complicated. We're considering extending the envoy's runtime to support self-defined types, but not sure if it is a proper solution.
Does anyone have a better solution?
cc. @snowp
The main problem with this from a design standpoint is that filters can change the target cluster as they run, so the only thing that marginally makes sense would be to provide the configuration for whatever cluster is in the route cache at the time the filter is first invoked. This would be non-trivial to implement and also I think be fairly confusing in certain cases, so I'm not sure we want this.
Couldn't you just sent per-cluster info as part of the filter config itself in either LDS or ECDS?
The main problem with this from a design standpoint is that filters can change the target cluster as they run, so the only thing that marginally makes sense would be to provide the configuration for whatever cluster is in the route cache at the time the filter is first invoked. This would be non-trivial to implement and also I think be fairly confusing in certain cases, so I'm not sure we want this.
Couldn't you just sent per-cluster info as part of the filter config itself in either LDS or ECDS?
Sending per-cluster info in LDS or ECDS won't solve the problem since other filters can change the target cluster as they run. Further more, we have to duplicate the same per-cluster config for every filter. So Neither solution really solves the problem that filters may change the target cluster. Maybe we shouldn't implement it in filters, but we haven't found a better way.
Maybe we shouldn't implement it in filters, but we haven't found a better way.
Can you describe in more detail the problem you are actually trying to solve? That might help.
Maybe we shouldn't implement it in filters, but we haven't found a better way.
Can you describe in more detail the problem you are actually trying to solve? That might help.
We have some policies implemented in the SDK which are very different from Envoy, such as circuit breaker. We're going to port these policies into Envoy via filters, both network filters and http filters, and the configuration of these policies is basically cluster-level. So we need to sent the per-cluster configuration in xDS but don't know which way is right.
But it seems that cluster updating will result in re-connection to all endpoints.
I read the code carefully and I had an idea, we can migrate the conn_pools from the old ClusterEntry's host to newly created ClusterEntry's host if their addresses are the same, but not just drain all conn pools then create new ones. Is that reasonable, or are there any bad cases if we did so?
Even if the config is per-cluster, if it's relevant to the filter, can't you just provide a config map to the filter directly via LDS or ECDS? The config is needed at the time the filter executes, so can't it just live with the filter?
It’s doable but not practical in my opinion, as my colleague who are working on control-plane may be confused to scatter per-cluster config in various filters. It seems more feasible to me to do a per-cluster-config since Envoy already has a per-route-config for filters.
It’s doable but not practical in my opinion, as my colleague who are working on control-plane may be confused to scatter per-cluster config in various filters. It seems more feasible to me to do a per-cluster-config since Envoy already has a per-route-config for filters.
I think we are at somewhat of an impasse given the above conversation about how the routed cluster can change between filters.
The only thing I can think of might be to do some type of "intelligent cluster update" like we do for LDS, where we allow certain clusters attributes (like metadata) to be swapped inline if nothing else changes. cc @lambdai
It's hard to classify a swap-in is fine or not. At listener, we are pretty sure the filter-chain only change should support swap-in, and filter chain only update does cover the majority of the update.
Does the cluster follow the same pattern? To me, the majority of the cluster update is delegated to EDS so plain cluster update is rare.
And EDS update also introduced close_connections_on_host_set_change. Only several use cases that require high host affinity on hash-based lb would set it.
Is that saying @WeavingGao you are setting close_connections_on_host_set_change to true? or not using eds?
Is that saying @WeavingGao you are setting close_connections_on_host_set_change to true? or not using eds?
No, I'm not using EDS since it's not an endpoint specific config.
The only thing I can think of might be to do some type of "intelligent cluster update" like we do for LDS, where we allow certain clusters attributes (like metadata) to be swapped inline if nothing else changes.
I think what @mattklein123 said above might really solve my problem.
just provide a config map to the filter directly via LDS or ECDS
Another reason I'm not doing that is that there might be over 1000 clusters, an update to any of these will cause the update to the whole config map.
It's hard to classify a swap-in is fine or not.
Can we add a configuration to flag whether swap-in is available or not?
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.