Skip to content

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

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

Open
GuyStone opened this issue Mar 10, 2025 · 2 comments

Comments

@GuyStone
Copy link

GuyStone commented Mar 10, 2025

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\"}}'")


@mheap
Copy link
Member

mheap commented Mar 11, 2025

This looks like a bug to me too. Does it happen if you include the port number in the target?

@GuyStone
Copy link
Author

GuyStone commented Mar 11, 2025

@mheap This looks like a bug to me too. Does it happen if you include the port number in the target?

Adding the port number works 🙌

I am using SRV records which is why there is no port number - I should have specified that in the issue 🙈. Including a port with the SRV record - e.g. srv_recorname:port - works. It's inaccurate as the port included will be ignored and instead the resolved port is used, but it does allow DecK to sync correctly.

@GuyStone GuyStone changed the title Failed to create existing targets for upstream - UNIQUE violation SRV Record failed to create existing targets for upstream when port is not defined - UNIQUE violation Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants