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

reverseproxy: Fix dial placeholders, SRV, active health checks #3780

Merged
merged 2 commits into from
Oct 13, 2020

Conversation

mholt
Copy link
Member

@mholt mholt commented Oct 7, 2020

Supersedes #3776
Partially reverts or updates #3756, #3693, and #3695

Please take a look @mohammed90 @francislavoie and users we know to have been affected previously: @waiyip-aquabyte, @danlsgiga, @markuswustenberg, and @yflau. Build artifacts are available in the CI / actions area.

My understanding is that fixing #3753 introduced regressions fixed by #3693 and #3695, which broke dynamic upstreams (using placeholders in dial addresses) as reported in #3768. Instead of piling more code on top to patch the regressions, this change causes the recently-added integration tests to pass without adding more complexity. I think the key is to just not parse the network address at provision-time, which we can't reliably do because we don't know whether it is a usable address (because it supports placeholders, the address might not be able to be evaluated until request-time).

@mohammed90 I did bring over the new tests you wrote for #3776 and they pass, but I did not add them to this commit because I want you to get credit for those, so if you would like to push them to this branch before we merge, that would be great. One test did not pass (TestDialWithPlaceholderActiveHealthcheck) but I think that test is not really valid anyway, since we don't parse the addresses up front.

@mholt mholt added bug 🐞 Something isn't working under review 🧐 Review is pending before merging needs tests 💯 Requires automated tests labels Oct 7, 2020
@mholt mholt added this to the v2.2.1 milestone Oct 7, 2020
@francislavoie
Copy link
Member

I think it helps to review from this point, only focusing on the changes in the reverseproxy package:

b95b87381a282e1fe57295d145b71645d7801f07...aeceb32e976cca48496e5c051ae113ef5a4b362a#diff-142e2362ff

This is everything from this PR back to just before the first reverseproxy change @mohammed90 introduced.

@francislavoie
Copy link
Member

This looks good to me. Quick summary of the diff I linked above, from what I'm reading:

  • Caddyfile adapter adds default port of 80 if the port is empty
  • During provisioning, SRV compat is checked (disallow active health checks, disallow mixing with non-SRV dial)
  • During provisioning, the active health check port is set on every upstream (override if health_port is set, basically), new field in Upstream struct for it
  • The upstream dial is now passed through the replacer when active health checks happen
  • If the active health check port is non-zero, then the dial address is set to that port (and the network set to TCP is unix socket)
  • If the upstream is not SRV and has more than one port, errors out.

Seems all logical to me.

francislavoie
francislavoie previously approved these changes Oct 7, 2020
Copy link
Member

@mohammed90 mohammed90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Francis' summary is on-point!

@mholt
Copy link
Member Author

mholt commented Oct 10, 2020

Excellent, thanks @mohammed90 !

Can any of the affected users please re-test with this PR then? It's ready to merge. Would be nice to have confirmation that it works in real use cases.

@danlsgiga
Copy link
Contributor

Going to check shortly and give a feedback here! Thanks for working on this @mohammed90

@danlsgiga
Copy link
Contributor

Alright, according to my internal tests, all is working as expected! ;) Thanks once again everyone that worked on this! ❤️

@mholt
Copy link
Member Author

mholt commented Oct 13, 2020

Excellent, thanks @danlsgiga -- normally I would wait for more affected users to test but we've already waited about a week and in the interest of getting the bug fixes out I think I'll merge this in and tag a release today.

@mholt mholt merged commit c7efb03 into master Oct 13, 2020
@mholt mholt deleted the fix-rev-proxy branch October 13, 2020 16:52
@mholt mholt removed the under review 🧐 Review is pending before merging label Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working needs tests 💯 Requires automated tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants