Refactor `ClusterFactoryImplBase::create` with "legacy to typed" conversion
- Dominant language
- C++
- Stars
- 28.9k
- Forks
- 5.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 428
Description
I would ideally like to see this structured by having all cluster types implemented as extensions, and then supporting the legacy types by basically converting the legacy configs to the extension configs. In other words, I think we ideally want something like the following logic (pseudo-code):
```
Cluster::CustomClusterType cluster_type =
cluster.has_cluster_type()
? cluster.cluster_type()
: ConvertLegacyConfigToExtensionConfig(cluster);
std::string cluster_config_type_name =
TypeUtil::typeUrlToDescriptorFullName(cluster_type.typed_config().type_url());
ClusterFactory* factory =
Registry::FactoryRegistry::getFactoryByType(cluster_config_type_name);
```
The idea is that `ConvertLegacyConfigToExtensionConfig()` would contain the code to convert the legacy enum-based config to the corresponding extension config.
I believe that @wbpcode previously did something like this for LB policies, so we probably want to model this work on that same pattern.
_Originally posted by @markdroth in https://github.com/envoyproxy/envoy/pull/38483#discussion_r1960310099_
Contributor guide
Assessment
This issue has not been assessed yet.