Kong / Kong/deck

SRV Record failed to create existing targets for upstream when port is not defined - UNIQUE violation

Open
#1,556 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
503
Forks
137
Avg merge
3d 5h
Merged PRs (30d)
20

Description

Kong Version 3.9.0.0
decK Version: 1.45.0

I'm using `deck gateway sync` to keep a declarative kong config in sync with a gateway. Trying out upstreams with targets, I noticed DecK identifies all target as new and recreates them. `sync` will fail because of a `UNIQUE violation`. Is recreating them intentional, or is there a way for targets to be unique? feels like a bug?

Example Below

```
_format_version: "3.0"

upstreams:
- name: example
targets:
- target: www.google.com
```

```
% deck gateway diff ./config/*.yaml
creating target www.google.com for upstream b3b52864-4ca4-4b6c-87d6-ffc80889108e
deleting target www.google.com:8000 for upstream b3b52864-4ca4-4b6c-87d6-ffc80889108e
Summary:
Created: 1
Updated: 0
Deleted: 1

% deck gateway sync ./config/*.yaml
creating target www.google.com for upstream b3b52864-4ca4-4b6c-87d6-ffc80889108e
Summary:
Created: 0
Updated: 0
Deleted: 0
Error: 1 errors occurred:
while processing event: Create target www.google.com for upstream b3b52864-4ca4-4b6c-87d6-ffc80889108e failed: HTTP status 409 (message: "UNIQUE violation detected on '{target=\"www.google.com:8000\",upstream={id=\"b3b52864-4ca4-4b6c-87d6-ffc80889108e\"}}'")

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the shown declarative configuration using `deck gateway diff` and `deck gateway sync`. Trace how an upstream target without a port is compared with Kong's returned `:8000` target; done means the existing target is recognized and sync no longer attempts a conflicting create or reports a UNIQUE violation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.