Skip to content

Commit

Permalink
T3c uses V5 api by default and will fallback to V4 (#7774)
Browse files Browse the repository at this point in the history
* Updated tests to work with API V5

* Updated to work with API V5 and fall back to API V4 if 5 is unavailable

* Added client help file for old/roback client

* Fixed formatting error

* Updated to use API V5

* Updated to use API V5

* Updated to use API V5

* More changes for API V5

* changes to deal with CI failures

* Updated ds active to reflect new active state

* Updated to generate random active state

* Updated to fix CI errors

* Updated "geoLimitCountries field to fix CI errors

* Updated servers field to serversv5

* Updated cachegroup to cacheGroup

* fixed field type

* fixed more server type issues

* fixed more server type issues

* fixed more incorrect server type issues

* fixed more incorrect server in test

* fixed missing quotes

* renamed servers cdn profiles and physicallocation

* updated error comment to reflect correct data

* updated GetServersCompat to return v5 response

* fixed issue with root tenant

* stopped using GetServersCompat

* skip deliveryservices that are set to INACTIVE

* requested changes

* fixed capabilities naming

* more requested changes

* removed more problematic nil checks
  • Loading branch information
jpappa200 committed Sep 13, 2023
1 parent 14ef9a4 commit a2720ee
Show file tree
Hide file tree
Showing 132 changed files with 6,961 additions and 6,649 deletions.
23 changes: 21 additions & 2 deletions cache-config/t3c-generate/cfgfile/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ func GetAllConfigs(
toData *t3cutil.ConfigData,
cfg config.Cfg,
) ([]t3cutil.ATSConfigFile, error) {
if toData.Server.HostName == nil {
if toData.Server.HostName == "" {
return nil, errors.New("server hostname is nil")
}
// if 0 get dataconfig.go was unable to get DS capabilities using APIv5
// because the end point has been removed and was added to the DS struct
// so we will get the data from DeliveryServices
if len(toData.DSRequiredCapabilities) == 0 {
toData.DSRequiredCapabilities = makeNewDsCaps(toData.DeliveryServices)
}

configFiles, warnings, err := MakeConfigFilesList(toData, cfg.Dir, cfg.ATSMajorVersion)
logWarnings("generating config files list: ", warnings)
Expand All @@ -49,7 +55,7 @@ func GetAllConfigs(
}

genTime := time.Now()
hdrCommentTxt := makeHeaderComment(*toData.Server.HostName, cfg.AppVersion(), toData.TrafficOpsURL, toData.TrafficOpsAddresses, genTime)
hdrCommentTxt := makeHeaderComment(toData.Server.HostName, cfg.AppVersion(), toData.TrafficOpsURL, toData.TrafficOpsAddresses, genTime)

hasSSLMultiCertConfig := false
configs := []t3cutil.ATSConfigFile{}
Expand Down Expand Up @@ -119,3 +125,16 @@ func logWarnings(context string, warnings []string) {
log.Warnln(context + warn)
}
}

func makeNewDsCaps(deliveryServices []atscfg.DeliveryService) map[int]map[atscfg.ServerCapability]struct{} {
svcReqCaps := map[int]map[atscfg.ServerCapability]struct{}{}
for _, service := range deliveryServices {
for _, dsCap := range service.RequiredCapabilities {
if _, ok := svcReqCaps[*service.ID]; !ok {
svcReqCaps[*service.ID] = map[atscfg.ServerCapability]struct{}{}
}
svcReqCaps[*service.ID][atscfg.ServerCapability(dsCap)] = struct{}{}
}
}
return svcReqCaps
}

0 comments on commit a2720ee

Please sign in to comment.