-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: stream subsystem support dns service discovery #8593
feat: stream subsystem support dns service discovery #8593
Conversation
t/discovery/stream/dns.t
Outdated
--- grep_error_log eval | ||
qr/proxy request to \S+/ | ||
--- grep_error_log_out | ||
proxy request to 127.0.0.1:nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need to reject zero port in the stream, as there is not default port for TCP.
proxy request to 127.0.0.1:nil
such an error log looks like a bug in APISIX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For HTTP, we will fill node info in apisix/upstream.lua
Line 178 in 030019b
local function fill_node_info(up_conf, scheme, is_stream) |
For Stream, if node port is 0, it will not be filled node info, so the error log is like proxy request to 127.0.0.1:nil
which in the apisix/balancer.lua
Line 384 in 030019b
core.log.info("proxy request to ", server.host, ":", server.port) |
i wonder if we need to reject zero port in the stream, we should reject in where, can you give me some hints? thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i ignore zero port node when is in the stream subsystem.
t/discovery/stream/dns.t
Outdated
|
||
|
||
|
||
=== TEST 17: Invalid order type in config.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these tests? The order of type doesn't matter with the L4 or L7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will remove these tests later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
t/discovery/stream/dns.t
Outdated
type: roundrobin | ||
id: 1 | ||
--- error_log | ||
127.0.0.1:53 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected error log is not long enough and confusing.
Why don't we use
apisix/t/discovery/dns/sanity.t
Line 89 in 9345425
connect to 127.0.0.1:53 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
t/discovery/stream/dns.t
Outdated
|
||
if (!$block->stream_request) { | ||
# GET /hello HTTP/1.0\r\nHost: 127.0.0.1:1985\r\n\r\n | ||
$block->set_value("stream_request", "\x47\x45\x54\x20\x2f\x68\x65\x6c\x6c\x6f\x20\x48\x54\x54\x50\x2f\x31\x2e\x30\x0d\x0a\x48\x6f\x73\x74\x3a\x20\x31\x32\x37\x2e\x30\x2e\x30\x2e\x31\x3a\x31\x39\x38\x35\x0d\x0a\x0d\x0a"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spend some time and figure out we can set it directly with:
$block->set_value("stream_request", "\x47\x45\x54\x20\x2f\x68\x65\x6c\x6c\x6f\x20\x48\x54\x54\x50\x2f\x31\x2e\x30\x0d\x0a\x48\x6f\x73\x74\x3a\x20\x31\x32\x37\x2e\x30\x2e\x30\x2e\x31\x3a\x31\x39\x38\x35\x0d\x0a\x0d\x0a"); | |
$block->set_value("stream_request", "GET /hello HTTP/1.0\r\nHost: 127.0.0.1:1985\r\n\r\n"); |
* upstream/master: (67 commits) fix: grpc-transcode plugin: fix map data population (apache#8731) change(jwt-auth): unify apisix/core/vault.lua and apisix/secret/vault.lua (apache#8660) feat: stream subsystem support consul_kv service discovery (apache#8633) fix(proxy-mirror): use with uri rewrite (apache#8718) ci: move helper script to the right dir (apache#8691) refactor(pubsub): simpify the get_cmd implementation (apache#8608) feat: stream subsystem support kubernetes service discovery (apache#8640) docs: fix deployment links (apache#8714) fix: remove backslash before slash when encoding (apache#8684) ci: kafka should register port in the zookeeper same as exposed (apache#8672) docs: fix plugin config naming (apache#8701) docs: fix code block (apache#8700) docs: rename kms to secret (apache#8697) docs: replace transparent logos with white background logos (apache#8689) fix: upgrade lua-resty-etcd to 1.10.3 (apache#8668) fix: upgrade casbin to 1.41.3 to improve performance (apache#8676) chore: make send_stream_request more clear (apache#8627) feat: stream subsystem support nacos service discovery (apache#8584) feat: stream subsystem support dns service discovery (apache#8593) refactor(admin): refactor resource routes (apache#8611) ...
Description
Fixes #7779
For SRV record which has port 0, we will fallback to use the upstream protocol's default port.
i'm not sure what is the tcp protocol's default port, so my test case is temporary like below.
proxy request to 127.0.0.1:nil
i will modify
scheme_to_port
if need.Checklist