Remove cacheurl from Delivery Services#4644
Remove cacheurl from Delivery Services#4644rawlinp merged 84 commits intoapache:masterfrom shamrickus:cacheurl
Conversation
ocket8888
left a comment
There was a problem hiding this comment.
So to be clear, this PR removes support for the cacheurl, but does not remove it from the API? Like it'll always show it as null in responses because if you do a POST with some cacheurl value that doesn't get unmarshaled and doesn't get stored in the database, but from what I can see the structures marshaled for responses still have it.
I'm also not sure if imparting that behavior on API versions 1.x and 2.x constitutes a breaking change.
Only when querying old API versions on an update server. V3 should not have these fields while v1/v2 should. |
ocket8888
left a comment
There was a problem hiding this comment.
Compile error at traffic_ops/traffic_ops_golang/routing/routes.go:1232:119:
undefined: atscdn.GetCacheURLDotConfig
|
So like I was saying before, this removes support for GET /api/3.0/deliveryservices?limit=1 HTTP/1.1
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Cookie: mojolicious=eyJhdXRoX2RhdGEiOiJhZG1pbiIsImV4cGlyZXMiOjE1OTI5NTcyNjgsImJ5IjoidHJhZmZpY2NvbnRyb2wtZ28tdG9jb29raWUifQ--625c11141971227d3862de47c92810086ebd7389
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: application/json
Set-Cookie: mojolicious=eyJhdXRoX2RhdGEiOiJhZG1pbiIsImV4cGlyZXMiOjE1OTI5MzkyNjgsImJ5IjoidHJhZmZpY2NvbnRyb2wtZ28tdG9jb29raWUifQ--784bea340410815bda72048f7fa1c6cc6520e590; Path=/; Expires=Tue, 23 Jun 2020 19:07:48 GMT; Max-Age=3600; HttpOnly
Vary: Accept-Encoding
Whole-Content-Sha512: 94qFFF5yps/vfOFe/E3M285fBWJzgmpylXwwdGf4xa8w/J32nPboY2jgd2Ehi52jt1pK0zYtOc+Vtud3f/rVSA==
X-Server-Name: traffic_ops_golang/
Date: Tue, 23 Jun 2020 18:07:48 GMT
Content-Length: 806
{
"response": [
{
"active": true,
"anonymousBlockingEnabled": false,
"cacheurl": null,
"ccrDnsTtl": null,
"cdnId": 2,
"cdnName": "CDN-in-a-Box",
"checkPath": null,
"displayName": "Demo 1",
"dnsBypassCname": null,
"dnsBypassIp": null,
"dnsBypassIp6": null,
"dnsBypassTtl": null,
"dscp": 0,
"edgeHeaderRewrite": null,
"geoLimit": 0,
"geoLimitCountries": null,
"geoLimitRedirectURL": null,
"geoProvider": 0,
"globalMaxMbps": null,
"globalMaxTps": null,
"httpBypassFqdn": null,
"id": 1,
"infoUrl": null,
"initialDispersion": 1,
"ipv6RoutingEnabled": true,
"lastUpdated": "2020-06-23 18:04:18+00",
"logsEnabled": true,
"longDesc": "Apachecon North America 2018",
"longDesc1": null,
"longDesc2": null,
"matchList": [
{
"type": "HOST_REGEXP",
"setNumber": 0,
"pattern": ".*\\.demo1\\..*"
}
],
"maxDnsAnswers": null,
"midHeaderRewrite": null,
"missLat": 42,
"missLong": -88,
"multiSiteOrigin": false,
"originShield": null,
"orgServerFqdn": "http://origin.infra.ciab.test",
"profileDescription": null,
"profileId": null,
"profileName": null,
"protocol": 2,
"qstringIgnore": 0,
"rangeRequestHandling": 0,
"regexRemap": null,
"regionalGeoBlocking": false,
"remapText": null,
"routingName": "video",
"signed": false,
"sslKeyVersion": null,
"tenantId": 1,
"type": "HTTP",
"typeId": 1,
"xmlId": "demo1",
"exampleURLs": [
"http://video.demo1.mycdn.ciab.test",
"https://video.demo1.mycdn.ciab.test"
],
"deepCachingType": "NEVER",
"fqPacingRate": null,
"signingAlgorithm": null,
"tenant": "root",
"trResponseHeaders": null,
"trRequestHeaders": null,
"consistentHashRegex": null,
"consistentHashQueryParams": [
"abc",
"pdq",
"xxx",
"zyx"
],
"maxOriginConnections": 0,
"ecsEnabled": false,
"rangeSliceBlockSize": null,
"topology": null
}
]
} |
|
With my original changes that didn't remove the unused methods this was not possible. Since those have now been removed I can remove it from the v3 api. |
ocket8888
left a comment
There was a problem hiding this comment.
API/client integration tests (v1) broken:
# github.com/apache/trafficcontrol/traffic_ops/testing/api/v1 [github.com/apache/trafficcontrol/traffic_ops/testing/api/v1.test]
./deliveryservices_test.go:362:35: ds.DeliveryServiceNullableV11 undefined (type tc.DeliveryServiceNullable has no field or method DeliveryServiceNullableV11)
FAIL github.com/apache/trafficcontrol/traffic_ops/testing/api/v1 [build failed]
v2 tests pass
v3 tests failing on TestDeliveryServices with:
topologies_test.go:57: Response: &{{a topology my-topology [{0 parentCachegroup [] <nil>} {0 secondaryCachegroup [] <nil>} {0 cachegroup1 [0 1] <nil>}] <nil>} {[{topology was created. success}]}}
topologies_test.go:57: Response: &{{another topology another-topology [{0 parentCachegroup [] <nil>} {0 cachegroup1 [0] <nil>} {0 secondaryCachegroup [] <nil>} {0 cachegroup2 [2] <nil>}] <nil>} {[{topology was created. success}]}}
topologies_test.go:57: Response: &{{A topology with secondary parents secondary-parents [{0 parentCachegroup [] <nil>} {0 cachegroup1 [0 2] <nil>} {0 secondaryCachegroup [] <nil>} {0 fallback1 [2 0] <nil>} {0 fallback2 [2 0] <nil>}] <nil>} {[{topology was created. success}]}}
topologies_test.go:57: Response: &{{A 4-tier topology 4-tiers [{0 parentCachegroup [] <nil>} {0 parentCachegroup2 [0] <nil>} {0 cachegroup1 [1] <nil>} {0 secondaryCachegroup [1 0] <nil>} {0 fallback1 [3] <nil>}] <nil>} {[{topology was created. success}]}}
deliveryservices_test.go:248: expected: no error updating topology-based header rewrite fields for topology-based DS, actual: 404 Not Found[404] - Error requesting Traffic Ops https://localhost:6443/api/3.0/deliveryservices/215 {"alerts":[{"text":"topology not found","level":"error"}]}
|
Test failures should be fixed now |
|
Seeing this in the v1 tests: |
|
v1 issues should be fixed |
|
just following up on status of this. is this waiting for after 5.0 release? |
|
At the least, probably best for whatever release perl gets removed in. |
|
Should be ready for re-review. Not mentioned in the original PR but it is good to also test compatibility with old versions. |
ocket8888
left a comment
There was a problem hiding this comment.
I think this should only edit the tc-fixtures.json in v4/ - also, why'd you delete the userdeliveryservices_test.go file in v1/?
Also, I think you already know this, but the docs have a bunch of references to the now-undefined ds-cacheurl label.
ocket8888
left a comment
There was a problem hiding this comment.
Would you mind adding GoDoc comments to the new exported symbols?
rawlinp
left a comment
There was a problem hiding this comment.
I added a bunch of comments as I went along, but it might be easier to understand if you go through all the comments first before making changes. Basically it boils down to reducing duplication and making it easier to make future changes to the DS API.
traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go
Outdated
Show resolved
Hide resolved
traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go
Outdated
Show resolved
Hide resolved
traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go
Outdated
Show resolved
Hide resolved
traffic_ops/traffic_ops_golang/deliveryservice/deliveryservices.go
Outdated
Show resolved
Hide resolved
…ol into cacheurl" This reverts commit 2a92ba59e59bc01b0b8b16c63c2d59b500fcaea8, reversing changes made to 1f4ec08.
ocket8888
left a comment
There was a problem hiding this comment.
LGTM
This changes DSRs to use APIv4 Delivery Services - across all API versions - which is technically a breaking change. But the only fixes are to either quadruple the DSR handling code or rewrite it to not use the CRUDer. Since the latter is already in progress, I'm inclined to let that be tomorrow's problem.
| dsNullable := tc.DeliveryServiceNullableV30(dsV31) | ||
| ds := dsNullable.UpgradeToV4() | ||
| res, status, userErr, sysErr := createV40(w, r, inf, tc.DeliveryServiceV40(ds)) | ||
| if res == nil { |
There was a problem hiding this comment.
Should we be checking userErr != nil || sysErr != nil instead?
There was a problem hiding this comment.
I'm just doing what the previous versions of this function did (but flipped). It looks like if there is an error in createV40, res will always be nil, otherwise it will have a value. I can still change it, but if I think it would make sense to also change all the create/updateV{old} functions too since they do the same thing.
What does this PR (Pull Request) do?
This does not finish #3225 as CacheURL exists in ATC5 and TO API v3, so until those are no longer supported CacheURL cannot be completely removed.
Which Traffic Control components are affected by this PR?
What is the best way to verify this PR?
Ensure db migration works
Verify CDN still works (specificially TO, TR, TP)
Verify modify/delete/create of DS in TP/TO
The following criteria are ALL met by this PR