Kong / kong

🦍 The Cloud-Native API Gateway and AI Gateway.
https://konghq.com/install/#kong-community
Apache License 2.0
38.42k stars 4.76k forks source link

Upsert target is not an upsert #12987

Open Sharparam opened 2 months ago

Sharparam commented 2 months ago

Is there an existing issue for this?

Kong version ($ kong version)

Kong 3.6.1

Current Behavior

Calling PUT /upstreams/{upstreamName}/targets/{target} returns 404 even though documentation says it is an upsert operation.

Expected Behavior

Calling the PUT endpoint should create the target if it does not exist.

(Creating a target with a POST request and then updating it with PUT works.)

Steps To Reproduce

  1. Create an upstream.
  2. Use the PUT API to upsert a target to it.

Anything else?

No response

bungle commented 2 months ago

Looks to be same as update: https://github.com/Kong/kong/blob/master/kong/api/routes/upstreams.lua#L216-L221

Not sure, but this may be because of historical purposes. But doc seems be then wrong. One of them is wrong.

bungle commented 2 months ago

I discussed this with @locao, and it looks like it is a bug (in code).

chronolaw commented 2 months ago

@bungle , do we have a ticket to track it?

samugi commented 2 months ago

--> KAG-4475

chronolaw commented 4 days ago

@samugi , do we have any updates?