kong
kong copied to clipboard
fix(clustering) improve wRPC protocol detection
Summary
The data-plane clustering code optimistically makes a request to the control-plane (HEAD /v1/wrpc
) to determine if it can use wRPC or not. If the request did not return a 404, it would assume wRPC.
We gate the presence of the /v1/wrpc
block based on the legacy_hybrid_protocol
config param and rely on NGINX to return a 404.
This is all behaving kinda finnicky in EE land (for reasons I spent an hour debugging and couldn't figure out). Needless to say, I think a more explicit form of feature detection is warranted.
Full changelog
-
/v1/wrpc
returns 200 immediately forHEAD
requests -
kong.clustering.utils.check_protocol_support
checks response codes more strictly now:-
404
=> legacy -
200
=> wrpc - anything else is an error
-
- renamed
06-lagacy_switch_spec.lua
=>06-legacy_switch_spec.lua
Added the legacy_hybrid_protocol
check to the test template. It didn't seem to break any tests, so :crossed_fingers: that this is good to go.
@chronolaw @Suika-Kong @hbagdi, any :+1:/:-1: on whether this should get merged for 3.0 or not? It's not a hill I would die on, but I think it's a worthwhile improvement, and making any kind of changes to the wRPC clustering API after 3.0 is out will be a lot harder to justify.
The current code seems to work well, I think this PR is not urgent and we can discuss it after 3.0 release.
Michael is going to cherry-pick https://github.com/Kong/kong/pull/9145/commits/7c299b48b338ee50b698acda4b49e0d02bd9700a as its own PR (because that fixes some test issues in EE). I moved this to a 3.1 milestone as a future improvement.
@flrgh Still pursuing this change?
@flrgh Still pursuing this change?
Yes I'd like to.
It's a little bit tougher to realize now that 3.0 is out though, since it changes the response-handling logic in the DP to be more strict, which could cause breakage. I probably need to change this to a feat
and merge the CP change (both here and in Koko) at least one minor release ahead of the DP changes.
Due to #9740, perhaps we could close it.
Due to #9740, perhaps we could close it.
Agreed. We can revisit this if anything changes later on.