- 
                Notifications
    You must be signed in to change notification settings 
- Fork 140
Add 503 status code when there are zero upstream endpoints #3406
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
Conversation
| nginx conf here: Showing the correct state file. This is the same for both initial deployment of resources and when scaling the tea deployment. | 
| Codecov ReportAll modified and coverable lines are covered by tests ✅ 
 Additional details and impacted files@@            Coverage Diff             @@
##             main    #3406      +/-   ##
==========================================
- Coverage   86.82%   86.77%   -0.06%     
==========================================
  Files         127      127              
  Lines       15011    15020       +9     
  Branches       62       62              
==========================================
  Hits        13034    13034              
- Misses       1828     1835       +7     
- Partials      149      151       +2     ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
| Here's some traffic results showing the correct 503 status code: Here is a snippet of the nginx logs showing no errors when returning a 503:  | 
3cbe049    to
    94598cf      
    Compare
  
    

Proposed changes
Add 503 status code when there are zero upstream endpoints.
Problem: When using NGINX Plus, the generated state file for an upstream was not correctly generating the 503 server for upstreams with zero endpoints.
Solution: On upstreams with zero endpoints, generate the correct nginx conf in the state file.
Testing: The 503 server socket shows up in the nginx plus API dashboard, both when initially deploying resources, and when scaling the deployment as described in #2090. Sending traffic to the upstream with zero endpoints correctly returns a 503 status code (instead of 502 as previously) and there is no longer an error message outputted in the nginx logs. Verified after deployment/pod gets ready, so the upstream endpoint becomes valid, the state file is updated correctly to have the correct upstream endpoint, and traffic flows correctly.
Closes #2090
Checklist
Before creating a PR, run through this checklist and mark each as complete.
Release notes
If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.