Skip to content

Commit a70c2ee

Browse files
authored
fix(apisix-standalone): conflict between upstream nodes and service discovery (#344)
1 parent fd7b922 commit a70c2ee

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

libs/backend-apisix-standalone/src/transformer.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ export const toADC = (input: typing.APISIXStandalone) => {
2828
pass_host: upstream.pass_host,
2929
upstream_host: upstream.upstream_host,
3030

31-
// Empty Lua tables will be encoded as "{}" rather than "[]" by cjson,
32-
// so this must be handled separately to prevent unexpected diff results.
33-
nodes: !isEmpty(upstream.nodes) ? upstream.nodes : [],
34-
3531
checks: upstream.checks,
3632
discovery_type: upstream.discovery_type,
3733
service_name: upstream.service_name,
3834
discovery_args: upstream.discovery_args,
35+
36+
...(upstream.nodes
37+
? {
38+
// Empty Lua tables will be encoded as "{}" rather than "[]" by cjson,
39+
// so this must be handled separately to prevent unexpected diff results.
40+
nodes: !isEmpty(upstream.nodes) ? upstream.nodes : [],
41+
}
42+
: {}),
3943
});
4044
return {
4145
services:

0 commit comments

Comments
 (0)