Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add automatic self-healing when using slice plugin to t3c #7719

Merged
merged 22 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
84c36cb
add self healing for slice plugin by default
jpappa200 Aug 8, 2023
9eaf3ba
adding auto self healing with slice plugin on mids
jpappa200 Aug 9, 2023
7f2c5f2
add self-healing to the slice plugin automatically
jpappa200 Aug 15, 2023
d6a03f8
add tests for automatic self-healing when using the slice plugin
jpappa200 Aug 15, 2023
8699137
Added documentation note for self-healing
jpappa200 Aug 17, 2023
42a9776
changed the way self-healing will be added to remap line
jpappa200 Aug 17, 2023
6b8f742
removed tests that are not needed
jpappa200 Aug 17, 2023
0bdb54a
put back tests that were removed by mistake
jpappa200 Aug 17, 2023
fb62184
put blank line back
jpappa200 Aug 17, 2023
632e5e9
added comments and change log entry
jpappa200 Aug 18, 2023
264add4
fixed broken test, with 2 exact same delivery services
jpappa200 Aug 18, 2023
a0d7ffd
fixed issue where empty param could add empty pparam to remap line
jpappa200 Aug 21, 2023
6621173
added tests for issue where empty param could add empty pparam to rem…
jpappa200 Aug 21, 2023
f8f7c16
commit for rebase
jpappa200 Sep 14, 2023
09ca034
fixed a couple typos
jpappa200 Sep 21, 2023
8515a1c
Added tests for no self healing param
jpappa200 Sep 22, 2023
5fb4b38
Added ability to remove auto self-healing for slice plugin
jpappa200 Sep 22, 2023
02996dd
updated deliveryservice documentation
jpappa200 Sep 22, 2023
390c89e
removed git merge lines
jpappa200 Sep 25, 2023
6bb5890
updated to use positive bools rather than negative
jpappa200 Sep 25, 2023
bb75b6f
changed scope of selfHeal param
jpappa200 Sep 26, 2023
c9b045c
changed to error instead of fatal
jpappa200 Sep 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7652](https://github.com/apache/trafficcontrol/pull/7652) *Traffic Control Cache Config (t3c)*: added rpmdb checks and use package data from t3c-apply-metadata.json if rpmdb is corrupt.
- [#7674](https://github.com/apache/trafficcontrol/issues/7674) *Traffic Ops*: Add the ability to indicate if a server failed its revalidate/config update.
- [#7784](https://github.com/apache/trafficcontrol/pull/7784) *Traffic Portal*: Added revert certificate functionality to the ssl-keys page.
- [#7719](https://github.com/apache/trafficcontrol/pull/7719) *t3c* self-healing will be added automatically when using the slice plugin.

### Changed
- [#7776](https://github.com/apache/trafficcontrol/pull/7776) *tc-health-client*: Added error message while issues interacting with Traffic Ops.
Expand Down
2 changes: 2 additions & 0 deletions docs/source/overview/delivery_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ Describes how HTTP "Range Requests" should be handled by the Delivery Service at
3
Use the `slice <https://github.com/apache/trafficserver/tree/master/plugins/experimental/slice>`_ plugin to slice range based requests into deterministic chunks. (Aliased as "3 - Use slice plugin" in Traffic Portal forms)

.. note:: The ``-–consider-ims`` parameter will automatically be added to the remap line by :term:`t3c` for self healing. If any other range request parameters are being used you must also include ``--consider-ims`` to enable self healing. Automatic self healing can be disabled by adding a remap.config parameter with a value of ``no_self_healing``

.. versionadded:: ATCv4.1

.. note:: Range Request Handling can only be implemented on :term:`cache servers` using :abbr:`ATS (Apache Traffic Server)` because of its dependence on :abbr:`ATS (Apache Traffic Server)` plugins. The value may be set on any Delivery Service, but will have no effect when the :term:`cache servers` that ultimately end up serving the content are e.g. Grove, Nginx, etc.
Expand Down
31 changes: 23 additions & 8 deletions lib/go-atscfg/remapdotconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
const DefaultFirstRemapConfigTemplateString = `map {{{Source}}} {{{Destination}}} {{{Strategy}}} {{{Dscp}}} {{{HeaderRewrite}}} {{{DropQstring}}} {{{Signing}}} {{{RegexRemap}}} {{{Cachekey}}} {{{RangeRequests}}} {{{Pacing}}} {{{RawText}}}`
const DefaultLastRemapConfigTemplateString = `map {{{Source}}} {{{Destination}}} {{{Strategy}}} {{{HeaderRewrite}}} {{{Cachekey}}} {{{RangeRequests}}} {{{RawText}}}`
const DefaultInnerRemapConfigTemplateString = DefaultLastRemapConfigTemplateString
const selfHealParam = `no_self_healing`

type LineTemplates map[string]*mustache.Template

Expand Down Expand Up @@ -223,23 +224,31 @@
// This sticks the DS parameters in a map.
// remap.config parameters use "<plugin>.pparam" key
// cachekey.config parameters retain the 'cachekey.config' key.
func classifyConfigParams(configParams []tc.ParameterV5) map[string][]tc.ParameterV5 {
func classifyConfigParams(configParams []tc.ParameterV5) (map[string][]tc.ParameterV5, bool) {
configParamMap := map[string][]tc.ParameterV5{}
selfHeal := true
for _, param := range configParams {
key := param.ConfigFile
if "remap.config" == key {
key = param.Name
if param.Value == selfHealParam {
selfHeal = false
continue
}
}
configParamMap[key] = append(configParamMap[key], param)
}
return configParamMap
return configParamMap, selfHeal
}

// For general <plugin>.pparam parameters.
func paramsStringFor(parameters []tc.ParameterV5, warnings *[]string) (paramsString string) {
uniquemap := map[string]int{}

for _, param := range parameters {
if strings.TrimSpace(param.Value) == "" {
continue

Check warning on line 250 in lib/go-atscfg/remapdotconfig.go

View check run for this annotation

Codecov / codecov/patch

lib/go-atscfg/remapdotconfig.go#L250

Added line #L250 was not covered by tests
}
paramsString += " @pparam=" + param.Value

// Try to extract argument
Expand Down Expand Up @@ -407,9 +416,10 @@
cachekeyArgs = getQStringIgnoreRemap(atsMajorVersion)
}

selfHeal := true
dsConfigParamsMap := map[string][]tc.ParameterV5{}
if nil != ds.ProfileID {
dsConfigParamsMap = classifyConfigParams(profilesConfigParams[*ds.ProfileID])
dsConfigParamsMap, selfHeal = classifyConfigParams(profilesConfigParams[*ds.ProfileID])
}

if len(dsConfigParamsMap) > 0 {
Expand All @@ -421,8 +431,11 @@
}

if ds.RangeRequestHandling != nil && (*ds.RangeRequestHandling == tc.RangeRequestHandlingCacheRangeRequest || *ds.RangeRequestHandling == tc.RangeRequestHandlingSlice) {
remapTags.RangeRequests = `@plugin=cache_range_requests.so` +
paramsStringFor(dsConfigParamsMap["cache_range_requests.pparam"], &warnings)
crrParam := paramsStringFor(dsConfigParamsMap["cache_range_requests.pparam"], &warnings)
remapTags.RangeRequests = `@plugin=cache_range_requests.so` + crrParam
if *ds.RangeRequestHandling == tc.RangeRequestHandlingSlice && !strings.Contains(crrParam, "--consider-ims") && selfHeal {
remapTags.RangeRequests += ` @pparam=--consider-ims`
}
}

isLastCache, err := serverIsLastCacheForDS(server, &ds, nameTopologies, cacheGroups)
Expand Down Expand Up @@ -694,7 +707,7 @@
remapTags.HeaderRewrite = `@plugin=header_rewrite.so @pparam=` + edgeHeaderRewriteConfigFileName(ds.XMLID)
}

dsConfigParamsMap := classifyConfigParams(remapConfigParams)
dsConfigParamsMap, selfHeal := classifyConfigParams(remapConfigParams)

if ds.SigningAlgorithm != nil && *ds.SigningAlgorithm != "" {
if *ds.SigningAlgorithm == tc.SigningAlgorithmURLSig {
Expand Down Expand Up @@ -772,8 +785,10 @@
}

if crr {
rangeReqTxt += `@plugin=cache_range_requests.so ` +
paramsStringFor(dsConfigParamsMap["cache_range_requests.pparam"], &warnings)
rangeReqTxt += `@plugin=cache_range_requests.so ` + paramsStringFor(dsConfigParamsMap["cache_range_requests.pparam"], &warnings)
if *ds.RangeRequestHandling == tc.RangeRequestHandlingSlice && !strings.Contains(rangeReqTxt, "--consider-ims") && selfHeal {
rangeReqTxt += ` @pparam=--consider-ims`
}
}
}

Expand Down
Loading
Loading