trafficcontrol icon indicating copy to clipboard operation
trafficcontrol copied to clipboard

Add the option to include custom VCL through parameters

Open AbdelrahmanElawady opened this issue 1 year ago • 1 comments

This PR adds the option to include custom VCL through parameters in Varnish cache. This allows importing plugins (VMODs) and using them throughout the VCL file. It allows adding custom logic that is not handled by t3c. For example adding the functionality of some ATS plugins like Header Rewrite and Regex Remap.

It expects the subroutine that the code should be appended to so the user can have custom logic in different parts of the transaction lifecycle.


Which Traffic Control components are affected by this PR?

  • Traffic Control Cache Config (t3c, formerly ORT)

What is the best way to verify this PR?

  • Using CDN-in-a-Box, edit the edge parameters to include custom VCL. For example here is some code to remove via header in case of a test endpoint:
{
			"configFile": "default.vcl",
			"name": "vcl_deliver",
			"secure": false,
			"value": "if (req.url ~ \"/test\") {unset resp.http.via;}"
}
  • Run docker-compose exec enroller curl -L -o /dev/null -D - -s "http://video.demo1.mycdn.ciab.test/test" to print response headers.
  • via header should not be printed

PR submission checklist

AbdelrahmanElawady avatar Oct 25 '23 19:10 AbdelrahmanElawady

Codecov Report

Merging #7850 (224ce75) into master (23e9248) will decrease coverage by 2.90%. Report is 35 commits behind head on master. The diff coverage is 20.00%.

@@             Coverage Diff              @@
##             master    #7850      +/-   ##
============================================
- Coverage     31.87%   28.97%   -2.90%     
  Complexity       98       98              
============================================
  Files           717      603     -114     
  Lines         82756    77425    -5331     
  Branches        970       90     -880     
============================================
- Hits          26377    22437    -3940     
+ Misses        54218    52894    -1324     
+ Partials       2161     2094      -67     
Flag Coverage Δ
golib_unit 53.88% <33.33%> (+0.30%) :arrow_up:
grove_unit 12.02% <ø> (ø)
t3c_unit 5.80% <0.00%> (-0.12%) :arrow_down:
traffic_monitor_unit 26.44% <ø> (ø)
traffic_ops_unit 21.68% <ø> (ø)
traffic_portal_v2 ?
traffic_stats_unit 10.78% <ø> (ø)
unit_tests 25.81% <20.00%> (-3.39%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
cache-config/t3c-apply/config/config.go 0.00% <ø> (ø)
cache-config/t3c-apply/torequest/cmd.go 0.00% <ø> (ø)
cache-config/t3c-apply/torequest/torequest.go 5.65% <ø> (ø)
cache-config/t3c-apply/util/gitutil.go 0.00% <ø> (ø)
cache-config/t3c-apply/util/util.go 0.00% <ø> (ø)
cache-config/t3c-check-refs/config/config.go 0.00% <ø> (ø)
cache-config/t3c-check-refs/t3c-check-refs.go 1.78% <ø> (ø)
cache-config/t3c-generate/cfgfile/all.go 51.38% <ø> (ø)
cache-config/t3c-generate/cfgfile/routing.go 84.00% <ø> (ø)
cache-config/t3c-generate/cfgfile/sslkeys.go 0.00% <ø> (ø)
... and 64 more

... and 152 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Oct 25 '23 19:10 codecov[bot]