rawlinp commented on a change in pull request #4724:
URL: https://github.com/apache/trafficcontrol/pull/4724#discussion_r437056996
##########
File path:
traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/ConfigHandler.java
##########
@@ -454,6 +476,31 @@ private void parseCacheConfig(final JsonNode
contentServers, final CacheRegister
return deliveryServiceMap;
}
+ private void parseTopologyConfig(final JsonNode allTopologies, final
Map<String, DeliveryService> deliveryServiceMap, final CacheRegister
cacheRegister) {
+ final Map<String, List<String>> topologyMap = new HashMap<>();
+ allTopologies.fieldNames().forEachRemaining((String
topologyName) -> {
+ final List<String> nodes = new ArrayList<>();
+
allTopologies.get(topologyName).get("nodes").forEach((JsonNode cache) ->
nodes.add(cache.textValue()));
+ topologyMap.put(topologyName, nodes);
+ });
+
+ deliveryServiceMap.forEach((xmlId, ds) -> {
+ final List<DeliveryServiceReference> dsReferences = new
ArrayList<>();
+ try {
+ dsReferences.add(new
DeliveryServiceReference(ds.getId(), ds.getDomain()));
Review comment:
So I think `ds.getDomain()` is wrong here. Looking at how this is done
for non-Topology-based DSes:
https://github.com/apache/trafficcontrol/blob/master/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/config/ConfigHandler.java#L393
in the CRConfig those names are not just the DS domain -- they're the full
cache hostnames (like in the example delivery URLs) plus any CNAME aliases:
```
"contentServers": {
"edge-01": {
"deliveryServices": {
"foo": [
"edge-01.foo.mycdn.example.com",
"blah.example.com",
"bar.someotherdomain.example.com"
],
```
I attempted to curl a topology-based DS, but was 302'd to just the DS domain
(e.g. foo.mycdn.example.com) rather than the actual cache (e.g.
edge-01.mycdn.example.com) as expected. I think we may need to basically
replicate the functionality of TO's CRConfig generation for those hostname
arrays in TR for topology-based DSes. I think we should have enough information
in CRConfig to generate that data locally, since I think we may be able to use
the `matchsets` array on the DS objects.
Here is how it's done in TO:
https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/crconfig/servers.go#L257
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]