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

feat(cli): add 'drain' CLI command to set /status/ready to 503 #13838

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

tzssangglass
Copy link
Member

@tzssangglass tzssangglass commented Nov 6, 2024

Summary

This command updates the /status/ready endpoint to return a 503 Service Unavailable status code. This allows external tools, such as Kubernetes, to detect when Kong is not ready to receive traffic. Based on this response, Kubernetes can gracefully remove Kong from its load balancing pool according to its configured policies, facilitating a smooth shutdown process.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix: FTI-6276

This command updates the `/status/ready` endpoint to return a `503 Service Unavailable` status code.
This allows external tools, such as Kubernetes, to detect when Kong is not ready to receive traffic.
Based on this response, Kubernetes can gracefully remove Kong from its load balancing pool according
to its configured policies, facilitating a smooth shutdown process.

Fix: [FTI-6276](https://konghq.atlassian.net/browse/FTI-6276)
Signed-off-by: tzssangglass <[email protected]>
@github-actions github-actions bot added core/cli cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Nov 6, 2024
Signed-off-by: tzssangglass <[email protected]>
Signed-off-by: tzssangglass <[email protected]>
Signed-off-by: tzssangglass <[email protected]>
Signed-off-by: tzssangglass <[email protected]>
Signed-off-by: tzssangglass <[email protected]>
Signed-off-by: tzssangglass <[email protected]>
Signed-off-by: tzssangglass <[email protected]>
@tzssangglass tzssangglass marked this pull request as ready for review November 8, 2024 08:53
kong/status/ready.lua Outdated Show resolved Hide resolved
kong/status/ready.lua Outdated Show resolved Hide resolved
kong/status/ready.lua Outdated Show resolved Hide resolved
Signed-off-by: tzssangglass <[email protected]>
Signed-off-by: tzssangglass <[email protected]>
@windmgc windmgc changed the title feat(cli): add 'unready' CLI command to set /status/ready to 503 feat(cli): add 'drain' CLI command to set /status/ready to 503 Nov 13, 2024
Copy link
Member

@windmgc windmgc left a comment

Choose a reason for hiding this comment

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

Approve with one minor suggestion

kong/status/ready.lua Outdated Show resolved Hide resolved
apply comments

Co-authored-by: Keery Nie <[email protected]>
@tzssangglass
Copy link
Member Author

hi @mheap , PTAL this PR, it add a new command drain in Kong.

Copy link
Member

@gszr gszr left a comment

Choose a reason for hiding this comment

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

@tzssangglass Is there an internal spike doc with the alternatives we looked into for solving this issue? I am curious if adding yet another command isn't overcomplicating things -- maybe it's the best option, but I'm curious if this is the best interface we can provide among the options we researched. Adding new commands to the CLI increases complexity in a non-negligible way.

@gszr gszr requested review from dndx and fffonion November 18, 2024 21:59
Signed-off-by: tzssangglass <[email protected]>
@tzssangglass
Copy link
Member Author

Is there an internal spike doc with the alternatives we looked into for solving this issue?

We do not have an internal spike doc recording this or an alternative solution;

This was derived from discussions with members of the k8s team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/cli size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants