Skip to content
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

Set proper host and port in generated Kong services #4470

Closed
1 of 3 tasks
randmonkey opened this issue Aug 9, 2023 · 1 comment · Fixed by #4503
Closed
1 of 3 tasks

Set proper host and port in generated Kong services #4470

randmonkey opened this issue Aug 9, 2023 · 1 comment · Fixed by #4503
Labels
area/feature New feature or request area/kong Issue with Kong proxy behavior, rather than the controller

Comments

@randmonkey
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Problem Statement

Currently KIC sets host of generated Kong service to <service-name>.<service-namespace>.<port>.svc, and does not set port field (thus port will be set to the deafult value 80). Although the real backends are specified by upstreams of the service, and the host and port does not affect real traffic, it will bring much confusion when it displays to users, and may bring additional issues to plugins.
Now we need to set the host and port to make less difference as using Kong without KIC, to bring less confusion to the visibility layer (like displaying on Konnect or Kong manager) and plugins.

Proposed Solution

  • set host to the real (resolvable) host of the backend service if possible

    • If there are multiple backend services, like multiple backendRefs in gateway API *Route?
  • set port to be same as the real backend service port if possible

    • If the port could not be set as a number (like specifying port in string mode), what should we put here?

Additional information

No response

Acceptance Criteria

  • host of generated Kong service is set to a resolvable host of the backend service if possible
  • port of generated Kong service is set to the real port number of backend service if possible
@randmonkey randmonkey added area/feature New feature or request area/kong Issue with Kong proxy behavior, rather than the controller labels Aug 9, 2023
@rainest
Copy link
Contributor

rainest commented Aug 10, 2023

host must be the upstream name with the current Kong implementation, and I don't expect that to change.

Upstreams are implemented as a sort of pseudo DNS server. Kong's internal hostname resolution first searches for the service hostname in the upstream name list before sending it out to the external resolver. Changing the hostname would mean that we attempt to resolve externally and ignore our upstreams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/feature New feature or request area/kong Issue with Kong proxy behavior, rather than the controller
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants