Skip to content

feat: support dns parse in stream subsystem #7733

Description

@NJLOVER

Current Behavior

i add a stream_route with host gatorcloud-pg.postgres-system.svc.cluster.local( first i use gatorcloud-pg.postgres-system, it doesn't work too )
{
"server_port": 9102,
"upstream": {
"type": "roundrobin",
"nodes": {
"gatorcloud-pg.postgres-system.svc.cluster.local:5432": 1
}
}
}

the error log is:

2022/08/18 07:46:16 [error] 45#45: *13383 stream [lua] resolver.lua:47: parse_domain(): failed to parse domain: gatorcloud-pg.postgres-system.svc.cluster.local, error: failed to query the DNS server: dns client error: 101 empty record received while prereading client data, client: 10.233.102.128, server: 0.0.0.0:9103
2022/08/18 07:46:16 [error] 45#45: *13383 stream [lua] upstream.lua:79: parse_domain_for_nodes(): dns resolver domain: gatorcloud-pg.postgres-system.svc.cluster.local error: failed to query the DNS server: dns client error: 101 empty record received while prereading client data, client: 10.233.102.128, server: 0.0.0.0:9103
2022/08/18 07:46:16 [error] 45#45: *13383 stream [lua] init.lua:942: stream_preread_phase(): failed to set upstream: no valid upstream node while prereading client data, client: 10.233.102.128, server: 0.0.0.0:9103

the same dns for route, it is ok.

{
"uri": "/test",
"methods": ["GET","POST","PUT","DELETE"],
"priority": 10000112,
"upstream": {
"type": "roundrobin",
"scheme": "http",
"nodes": {
"gatorcloud-pg.postgres-system.svc.cluster.local:5432": 1
}
}
}

2022/08/18 07:53:31 [error] 46#46: *67040 upstream prematurely closed connection while reading response header from upstream, client: 10.233.102.128, server: _, request: "GET /test HTTP/1.1", upstream: "http://10.233.19.207:5432/test", host: "172.30.3.230"

this log mean "gatorcloud-pg.postgres-system.svc.cluster.local:5432" resolve to 10.233.19.207:5432 in lv4.

Expected Behavior

dns resolve error

Error Logs

No response

Steps to Reproduce

use stream_route with a host upstream, then dns resolve error

Environment

apache/apisix:2.14.1-alpine

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions