Skip to content

Conversation

discostur
Copy link

@discostur discostur commented May 28, 2025

What this PR does / why we need it:

This PR implements support for using Kong Gateway's dedicated status port (8100) for health checks instead of the Admin API port (8444). This separation of concerns improves:

  • reduces "spam" to access_log
  • Reducing load on the Admin API port, which is used for configuration management
  • Following best practices by using dedicated endpoints for health monitoring

The implementation adds a new --kong-status-svc-port-names configuration flag (default: ["status"]) to discover Kong Gateway status endpoints, while maintaining full backward compatibility with existing Admin API-based health checks.

Which issue this PR fixes:

Users are complaining for years that the access log get spammed with status health checks:

Special notes for your reviewer:

  • Backward Compatibility: The implementation is fully backward compatible. If no status client is available, health checks will continue to use the Admin API as before.
  • Configuration: A new configuration option --kong-status-svc-port-names has been added with sensible defaults.
  • Testing: Comprehensive test coverage has been added for all new components, including unit tests, integration tests, and mock-based error scenario testing.
  • Service Discovery: The existing service discovery mechanism has been extended to support both Admin API ports (admin-tls, kong-admin-tls) and status ports (status) simultaneously.

PR Readiness Checklist:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@discostur discostur requested a review from a team as a code owner May 28, 2025 09:43
@CLAassistant
Copy link

CLAassistant commented May 28, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

codecov bot commented May 30, 2025

Codecov Report

Attention: Patch coverage is 73.18182% with 59 lines in your changes missing coverage. Please review.

Project coverage is 58.5%. Comparing base (78ebb72) to head (ed36ec1).

Files with missing lines Patch % Lines
internal/adminapi/client.go 29.2% 28 Missing and 1 partial ⚠️
internal/adminapi/status_client.go 76.7% 9 Missing and 4 partials ⚠️
internal/clients/status_readiness.go 91.2% 9 Missing and 1 partial ⚠️
internal/manager/run.go 0.0% 7 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (78ebb72) and HEAD (ed36ec1). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (78ebb72) HEAD (ed36ec1)
2 1
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #7460      +/-   ##
========================================
- Coverage   77.4%   58.5%   -18.9%     
========================================
  Files        220     222       +2     
  Lines      25368   25587     +219     
========================================
- Hits       19644   14980    -4664     
- Misses      4729    9916    +5187     
+ Partials     995     691     -304     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@discostur
Copy link
Author

Is somebody going to look at this? Or is anything missing?

@pmalek
Copy link
Member

pmalek commented Jun 16, 2025

Is somebody going to look at this? Or is anything missing?

Hey @discostur 👋. Thanks for the contribution.

The team will review this and will let you know if there's anything missing or that needs changing.

@programmer04 programmer04 self-requested a review June 23, 2025 13:13
Copy link
Member

@programmer04 programmer04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank @discostur for very thoughtful and useful PR! There is one suggestion.

Since the official client library is go-kong the logic can be moved here to benefit all users as follows.

Constructor NewClient(baseURL *string, client *http.Client) (*Client, error) can be extended in a non-breaking manner to accept functional options pattern
and introduce a new parameter to optionally set a different port for a status check.

Next in the method func (c *Client) Status(ctx context.Context) (*Status, error) based on whether the port is set or not, construct a request to a proper status address and execute the check.

After the proposed change, go-kong library has logic for status check built in. We'll avoid creating a dedicated client with request logic in the KIC repo. Instead, it can be properly handled for everybody and just used in KIC with a little additional logic.

WDYT? Are you willing to take care of it? I promise quick reviews and help in case of need

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's redundant

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@programmer04 thanks for your suggestions but unfortunately i don't have the time at the moment ... :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants