You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ro...@apache.org on 2021/09/07 20:01:27 UTC
[trafficcontrol] branch master updated: T3c hosting (#6166)
This is an automated email from the ASF dual-hosted git repository.
rob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 739c80a T3c hosting (#6166)
739c80a is described below
commit 739c80a0baa4a27af1c8d95cd372a38c95655865
Author: Evan Zelkowitz <ez...@apache.org>
AuthorDate: Tue Sep 7 14:01:14 2021 -0600
T3c hosting (#6166)
* Add a continue in the case the DS is not a LIVE service, so that it does not get added to the ramdisk hosting list
* Fix spacing
* Also remove topology nil check for live services. Fix tests so that the first is checking for a ram entry with a live service instead of non-live, second checks for no ramdisk entry
* We still need the non-topology assigned check
* Change text comparison to use helper function
---
lib/go-atscfg/hostingdotconfig.go | 28 +++++++++++++++++-----------
lib/go-atscfg/hostingdotconfig_test.go | 2 +-
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/lib/go-atscfg/hostingdotconfig.go b/lib/go-atscfg/hostingdotconfig.go
index d81b9cd..611d93d 100644
--- a/lib/go-atscfg/hostingdotconfig.go
+++ b/lib/go-atscfg/hostingdotconfig.go
@@ -125,25 +125,28 @@ func MakeHostingDotConfig(
if *ds.CDNID != *server.CDNID {
continue
}
- if ds.Topology == nil {
- if !*ds.Active && ((!isMid && !ServerHostingDotConfigEdgeIncludeInactive) || (isMid && !ServerHostingDotConfigMidIncludeInactive)) {
+
+ if !*ds.Active && ((!isMid && !ServerHostingDotConfigEdgeIncludeInactive) || (isMid && !ServerHostingDotConfigMidIncludeInactive)) {
+ continue
+ }
+
+ if isMid {
+ if !strings.HasSuffix(string(*ds.Type), tc.DSTypeLiveNationalSuffix) {
continue
}
- if isMid {
- if !strings.HasSuffix(string(*ds.Type), tc.DSTypeLiveNationalSuffix) {
- continue
- }
-
+ if ds.Topology == nil {
// mids: include all DSes with at least one server assigned
if len(dsServerMap[*ds.ID]) == 0 {
continue
}
- } else {
- if !strings.HasSuffix(string(*ds.Type), tc.DSTypeLiveNationalSuffix) && !strings.HasSuffix(string(*ds.Type), tc.DSTypeLiveSuffix) {
- continue
- }
+ }
+ } else {
+ if !strings.HasSuffix(string(*ds.Type), tc.DSTypeLiveNationalSuffix) && !strings.HasSuffix(string(*ds.Type), tc.DSTypeLiveSuffix) {
+ continue
+ }
+ if ds.Topology == nil {
// edges: only include DSes assigned to this edge
if dsServerMap[*ds.ID] == nil {
continue
@@ -196,6 +199,9 @@ func MakeHostingDotConfig(
if !topoHasServer {
continue
}
+ if !ds.Type.IsLive() {
+ continue
+ }
}
}
diff --git a/lib/go-atscfg/hostingdotconfig_test.go b/lib/go-atscfg/hostingdotconfig_test.go
index 1f0d0f6..c58b4cf 100644
--- a/lib/go-atscfg/hostingdotconfig_test.go
+++ b/lib/go-atscfg/hostingdotconfig_test.go
@@ -159,7 +159,7 @@ func TestMakeHostingDotConfigTopologiesIgnoreDSS(t *testing.T) {
dsTopology.ID = util.IntPtr(900)
dsTopology.Topology = util.StrPtr("t0")
dsTopology.Active = util.BoolPtr(true)
- dsType := tc.DSTypeHTTP
+ dsType := tc.DSTypeHTTPLive
dsTopology.Type = &dsType
dsTopologyWithoutServer := makeGenericDS()