You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/10/17 14:44:28 UTC
[GitHub] [trafficcontrol] zrhoffman opened a new pull request, #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
zrhoffman opened a new pull request, #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143
<!--
Thank you for contributing! Please be sure to read our contribution guidelines: https://github.com/apache/trafficcontrol/blob/master/CONTRIBUTING.md
If this closes or relates to an existing issue, please reference it using one of the following:
Closes: #ISSUE
Related: #ISSUE
If this PR fixes a security vulnerability, DO NOT submit! Instead, contact
the Apache Traffic Control Security Team at security@trafficcontrol.apache.org and follow the
guidelines at https://apache.org/security regarding vulnerability disclosure.
-->
This PR resolves #2388 by adding the *TTL Override* field to each CDN, which lets you override all TTLs in all Delivery Services of a CDN's snapshot with a single value.
<!-- **^ Add meaningful description above** --><hr/>
## Which Traffic Control components are affected by this PR?
<!-- Please delete all components from this list that are NOT affected by this PR.
Feel free to add the name of a tool or script that is affected but not on the list.
-->
- Traffic Ops
- Traffic Portal
## What is the best way to verify this PR?
<!-- Please include here ALL the steps necessary to test your PR.
If your PR has tests (and most should), provide the steps needed to run the tests.
If not, please provide step-by-step instructions to test the PR manually and explain why your PR does not need tests. -->
- Run the TO unit and API tests
- Run the TP integration tests
## PR submission checklist
- [x] This PR has tests <!-- If not, please delete this text and explain why this PR does not need tests. -->
- [x] This PR has documentation <!-- If not, please delete this text and explain why this PR does not need documentation. -->
- [x] This PR has a CHANGELOG.md entry <!-- A fix for a bug from an ATC release, an improvement, or a new feature should have a changelog entry. -->
- [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://apache.org/security) for details)
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] mitchell852 commented on pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
mitchell852 commented on PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#issuecomment-1281611037
@zrhoffman - how do you set this value? a parameter? a field on the CDN object? (sorry, didn't read the code)
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] srijeet0406 merged pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
srijeet0406 merged PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997524390
##########
docs/source/api/v4/cdns.rst:
##########
@@ -67,6 +67,7 @@ Response Structure
:id: The integral, unique identifier for the CDN
:lastUpdated: Date and time when the CDN was last modified in :ref:`non-rfc-datetime`
:name: The name of the CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
> I think you might have to add the term `CDN` to the glossary.
Changed `CDN` to an abbreviation in 53c02be419
##########
docs/source/api/v4/cdns.rst:
##########
@@ -135,6 +138,7 @@ Response Structure
:domainName: The top-level domain (TLD) assigned to the newly created CDN
:id: An integral, unique identifier for the newly created CDN
:name: The newly created CDN's name
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Changed `CDN` to an abbreviation in 53c02be419
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997558032
##########
docs/source/api/v4/cdns.rst:
##########
@@ -115,6 +117,7 @@ Request Structure
:dnssecEnabled: If ``true``, this CDN will use DNSSEC, if ``false`` it will not
:domainName: The top-level domain (TLD) belonging to the new CDN
:name: Name of the new CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Changed `CDN` to an abbreviation in 53c02be419
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#issuecomment-1282665698
> @zrhoffman - makes sense. looks good but how do you clear or unset the override value? set it to zero?
By submitting an empty field. Neither TO nor TP accept `0` for *TTL Override* field.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997557535
##########
traffic_ops/traffic_ops_golang/cdn/cdns.go:
##########
@@ -162,36 +176,75 @@ func (cdn *TOCDN) Delete() (error, error, int) {
return api.GenericDelete(cdn)
}
-func selectQuery() string {
+func selectQuery(apiVersion *api.Version) string {
+ var ttlOverrideColumn string
Review Comment:
Made it into its own function in d6c88722e4
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997519557
##########
docs/source/api/v4/cdns.rst:
##########
@@ -67,6 +67,7 @@ Response Structure
:id: The integral, unique identifier for the CDN
:lastUpdated: Date and time when the CDN was last modified in :ref:`non-rfc-datetime`
:name: The name of the CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Not repeating `set` in d81596bedf
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] srijeet0406 commented on a diff in pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
srijeet0406 commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997458989
##########
docs/source/api/v4/cdns.rst:
##########
@@ -67,6 +67,7 @@ Response Structure
:id: The integral, unique identifier for the CDN
:lastUpdated: Date and time when the CDN was last modified in :ref:`non-rfc-datetime`
:name: The name of the CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
I think you might have to add the term `CDN` to the glossary.
##########
docs/source/api/v4/cdns.rst:
##########
@@ -115,6 +117,7 @@ Request Structure
:dnssecEnabled: If ``true``, this CDN will use DNSSEC, if ``false`` it will not
:domainName: The top-level domain (TLD) belonging to the new CDN
:name: Name of the new CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Same comments here.
##########
docs/source/api/v5/cdns.rst:
##########
@@ -135,6 +138,7 @@ Response Structure
:domainName: The top-level domain (TLD) assigned to the newly created CDN
:id: An integral, unique identifier for the newly created CDN
:name: The newly created CDN's name
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Same
##########
traffic_ops/traffic_ops_golang/crconfig/deliveryservice.go:
##########
@@ -43,14 +43,33 @@ const DefaultTLDTTLNS = 3600 * time.Second
const GeoProviderMaxmindStr = "maxmindGeolocationService"
const GeoProviderNeustarStr = "neustarGeolocationService"
-func makeDSes(cdn string, domain string, tx *sql.Tx) (map[string]tc.CRConfigDeliveryService, error) {
+func makeDSes(cdn string, domain string, ttlOverride int, tx *sql.Tx) (map[string]tc.CRConfigDeliveryService, error) {
dses := map[string]tc.CRConfigDeliveryService{}
admin := CDNSOAAdmin
- expireSecondsStr := strconv.Itoa(int(CDNSOAExpire / time.Second))
- minimumSecondsStr := strconv.Itoa(int(CDNSOAMinimum / time.Second))
- refreshSecondsStr := strconv.Itoa(int(CDNSOARefresh / time.Second))
- retrySecondsStr := strconv.Itoa(int(CDNSOARetry / time.Second))
+ expireSeconds := int(CDNSOAExpire / time.Second)
+ minimumSeconds := int(CDNSOAMinimum / time.Second)
+ refreshSeconds := int(CDNSOARefresh / time.Second)
+ retrySeconds := int(CDNSOARetry / time.Second)
+ if ttlOverride > 0 {
+ if ttlOverride < expireSeconds {
Review Comment:
You don't need to change it if you don't want to, but maybe using the `math.min` function reduces the lines of code here? I'm fine either way.
##########
traffic_ops/traffic_ops_golang/cdn/cdns.go:
##########
@@ -162,36 +176,75 @@ func (cdn *TOCDN) Delete() (error, error, int) {
return api.GenericDelete(cdn)
}
-func selectQuery() string {
+func selectQuery(apiVersion *api.Version) string {
+ var ttlOverrideColumn string
Review Comment:
Since this code block is being replicated in a couple of different places, would you mind making it into it's own function?
##########
docs/source/api/v5/cdns.rst:
##########
@@ -67,6 +67,7 @@ Response Structure
:id: The integral, unique identifier for the CDN
:lastUpdated: Date and time when the CDN was last modified in :ref:`non-rfc-datetime`
:name: The name of the CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Same
##########
docs/source/api/v4/cdns.rst:
##########
@@ -135,6 +138,7 @@ Response Structure
:domainName: The top-level domain (TLD) assigned to the newly created CDN
:id: An integral, unique identifier for the newly created CDN
:name: The newly created CDN's name
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Same
##########
docs/source/api/v4/cdns.rst:
##########
@@ -67,6 +67,7 @@ Response Structure
:id: The integral, unique identifier for the CDN
:lastUpdated: Date and time when the CDN was last modified in :ref:`non-rfc-datetime`
:name: The name of the CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Also, the word `set` is repeated.
##########
traffic_ops/app/db/migrations/2022101700451329_add_ttl_override_to_cdn.up.sql:
##########
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+ALTER TABLE public.cdn
+ADD COLUMN ttl_override BIGINT DEFAULT NULL;
Review Comment:
Missing new line at the end of the file.
##########
traffic_ops/traffic_ops_golang/crconfig/deliveryservice_test.go:
##########
@@ -35,19 +35,53 @@ import (
"gopkg.in/DATA-DOG/go-sqlmock.v1"
)
-func randDS() tc.CRConfigDeliveryService {
+func randDS(ttlOverride int) tc.CRConfigDeliveryService {
// truePtr := true
falseStrPtr := "false"
// numStr := "42"
ttlAdmin := "traffic_ops"
- ttlExpire := "604800"
- ttlMinimum := "30"
- ttlRefresh := "28800"
- ttlRetry := "7200"
- ttl := util.IntPtr(test.RandInt())
- ttlStr := strconv.Itoa(*ttl)
- ttlNS := "3600"
- ttlSOA := "86400"
+ ttlExpire := 604800
+ ttlMinimum := 30
+ ttlRefresh := 28800
+ ttlRetry := 7200
+ if ttlOverride > 0 {
+ if ttlOverride < ttlExpire {
Review Comment:
Same comment about the `min` function here
##########
docs/source/api/v5/cdns.rst:
##########
@@ -115,6 +117,7 @@ Request Structure
:dnssecEnabled: If ``true``, this CDN will use DNSSEC, if ``false`` it will not
:domainName: The top-level domain (TLD) belonging to the new CDN
:name: Name of the new CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Same
##########
traffic_ops/app/db/migrations/2022101700451329_add_ttl_override_to_cdn.down.sql:
##########
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+ALTER TABLE public.cdn
+DROP COLUMN ttl_override;
Review Comment:
Missing new line at the end of the file.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997519827
##########
docs/source/api/v4/cdns.rst:
##########
@@ -115,6 +117,7 @@ Request Structure
:dnssecEnabled: If ``true``, this CDN will use DNSSEC, if ``false`` it will not
:domainName: The top-level domain (TLD) belonging to the new CDN
:name: Name of the new CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Not repeating `set` in d81596bedf
##########
docs/source/api/v4/cdns.rst:
##########
@@ -135,6 +138,7 @@ Response Structure
:domainName: The top-level domain (TLD) assigned to the newly created CDN
:id: An integral, unique identifier for the newly created CDN
:name: The newly created CDN's name
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Not repeating `set` in d81596bedf
##########
docs/source/api/v5/cdns.rst:
##########
@@ -115,6 +117,7 @@ Request Structure
:dnssecEnabled: If ``true``, this CDN will use DNSSEC, if ``false`` it will not
:domainName: The top-level domain (TLD) belonging to the new CDN
:name: Name of the new CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Not repeating `set` in d81596bedf
##########
docs/source/api/v5/cdns.rst:
##########
@@ -135,6 +138,7 @@ Response Structure
:domainName: The top-level domain (TLD) assigned to the newly created CDN
:id: An integral, unique identifier for the newly created CDN
:name: The newly created CDN's name
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Not repeating `set` in d81596bedf
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#issuecomment-1281620645
> @zrhoffman - how do you set this value? a parameter? a field on the CDN object? (sorry, didn't read the code)
A field directly on the CDN object.

It doesn't make sense to have as a global parameter, because global parameters are on the *ALL* CDN, but operators will commonly want to only upgrade Traffic Routers on a single CDN at a time, and TTLs on a CDN they're not upgrading should not be affected.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997518463
##########
traffic_ops/app/db/migrations/2022101700451329_add_ttl_override_to_cdn.down.sql:
##########
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+ALTER TABLE public.cdn
+DROP COLUMN ttl_override;
Review Comment:
There is a newline at the end of the file. If there was not, there would be that red minus sign and a *no newline at end of file* message
##########
traffic_ops/app/db/migrations/2022101700451329_add_ttl_override_to_cdn.up.sql:
##########
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+ALTER TABLE public.cdn
+ADD COLUMN ttl_override BIGINT DEFAULT NULL;
Review Comment:
There is a newline at the end of this file also
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997517886
##########
traffic_ops/traffic_ops_golang/crconfig/deliveryservice.go:
##########
@@ -43,14 +43,33 @@ const DefaultTLDTTLNS = 3600 * time.Second
const GeoProviderMaxmindStr = "maxmindGeolocationService"
const GeoProviderNeustarStr = "neustarGeolocationService"
-func makeDSes(cdn string, domain string, tx *sql.Tx) (map[string]tc.CRConfigDeliveryService, error) {
+func makeDSes(cdn string, domain string, ttlOverride int, tx *sql.Tx) (map[string]tc.CRConfigDeliveryService, error) {
dses := map[string]tc.CRConfigDeliveryService{}
admin := CDNSOAAdmin
- expireSecondsStr := strconv.Itoa(int(CDNSOAExpire / time.Second))
- minimumSecondsStr := strconv.Itoa(int(CDNSOAMinimum / time.Second))
- refreshSecondsStr := strconv.Itoa(int(CDNSOARefresh / time.Second))
- retrySecondsStr := strconv.Itoa(int(CDNSOARetry / time.Second))
+ expireSeconds := int(CDNSOAExpire / time.Second)
+ minimumSeconds := int(CDNSOAMinimum / time.Second)
+ refreshSeconds := int(CDNSOARefresh / time.Second)
+ retrySeconds := int(CDNSOARetry / time.Second)
+ if ttlOverride > 0 {
+ if ttlOverride < expireSeconds {
Review Comment:
Using `math.Min()` in f1340e3d56
##########
traffic_ops/traffic_ops_golang/crconfig/deliveryservice_test.go:
##########
@@ -35,19 +35,53 @@ import (
"gopkg.in/DATA-DOG/go-sqlmock.v1"
)
-func randDS() tc.CRConfigDeliveryService {
+func randDS(ttlOverride int) tc.CRConfigDeliveryService {
// truePtr := true
falseStrPtr := "false"
// numStr := "42"
ttlAdmin := "traffic_ops"
- ttlExpire := "604800"
- ttlMinimum := "30"
- ttlRefresh := "28800"
- ttlRetry := "7200"
- ttl := util.IntPtr(test.RandInt())
- ttlStr := strconv.Itoa(*ttl)
- ttlNS := "3600"
- ttlSOA := "86400"
+ ttlExpire := 604800
+ ttlMinimum := 30
+ ttlRefresh := 28800
+ ttlRetry := 7200
+ if ttlOverride > 0 {
+ if ttlOverride < ttlExpire {
Review Comment:
Using `math.Min()` in f1340e3d56
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] zrhoffman commented on a diff in pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
zrhoffman commented on code in PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#discussion_r997524525
##########
docs/source/api/v5/cdns.rst:
##########
@@ -115,6 +117,7 @@ Request Structure
:dnssecEnabled: If ``true``, this CDN will use DNSSEC, if ``false`` it will not
:domainName: The top-level domain (TLD) belonging to the new CDN
:name: Name of the new CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Changed `CDN` to an abbreviation in 53c02be419
##########
docs/source/api/v5/cdns.rst:
##########
@@ -135,6 +138,7 @@ Response Structure
:domainName: The top-level domain (TLD) assigned to the newly created CDN
:id: An integral, unique identifier for the newly created CDN
:name: The newly created CDN's name
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Changed `CDN` to an abbreviation in 53c02be419
##########
docs/source/api/v5/cdns.rst:
##########
@@ -67,6 +67,7 @@ Response Structure
:id: The integral, unique identifier for the CDN
:lastUpdated: Date and time when the CDN was last modified in :ref:`non-rfc-datetime`
:name: The name of the CDN
+:ttlOverride: A :abbr:`TTL (Time To Live)` value, in seconds, that, if set, overrides all set set TTL values on :term:`Delivery Services` in this :term:`CDN`
Review Comment:
Changed `CDN` to an abbreviation in 53c02be419
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [trafficcontrol] mitchell852 commented on pull request #7143: Override all Delivery Service TTLs in a CDN's Snapshot with a given value
Posted by GitBox <gi...@apache.org>.
mitchell852 commented on PR #7143:
URL: https://github.com/apache/trafficcontrol/pull/7143#issuecomment-1282451708
> A field directly on the CDN object.
@zrhoffman - makes sense. looks good but how do you clear or unset the override value? set it to zero?
--
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.
To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org