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

move pod label update to goroutine with retries #4835

Merged
merged 1 commit into from Dec 22, 2023

Conversation

oseoin
Copy link
Contributor

@oseoin oseoin commented Dec 22, 2023

Proposed changes

Behaviour when can't get pod after max attempts:

E1222 10:21:35.852087       1 main.go:809] Error getting pod on attempt 1 of 10: test error
E1222 10:21:40.865891       1 main.go:809] Error getting pod on attempt 2 of 10: test error
E1222 10:21:45.873099       1 main.go:809] Error getting pod on attempt 3 of 10: test error
E1222 10:21:50.879271       1 main.go:809] Error getting pod on attempt 4 of 10: test error
E1222 10:21:55.894960       1 main.go:809] Error getting pod on attempt 5 of 10: test error
E1222 10:22:00.908234       1 main.go:809] Error getting pod on attempt 6 of 10: test error
I1222 10:22:03.069004       1 leaderelection.go:260] successfully acquired lease default/nginx-ingress-leader
E1222 10:22:05.919809       1 main.go:809] Error getting pod on attempt 7 of 10: test error
E1222 10:22:10.930658       1 main.go:809] Error getting pod on attempt 8 of 10: test error
E1222 10:22:15.940513       1 main.go:809] Error getting pod on attempt 9 of 10: test error
E1222 10:22:20.955110       1 main.go:809] Error getting pod on attempt 10 of 10: test error
E1222 10:22:20.955185       1 main.go:838] Failed to update pod labels after 10 attempts

Behaviour when can't get pod for first N attempts and then succeeds:

E1222 10:22:58.249082       1 main.go:809] Error getting pod on attempt 1 of 10: test error
E1222 10:23:03.258668       1 main.go:809] Error getting pod on attempt 2 of 10: test error
E1222 10:23:08.266618       1 main.go:809] Error getting pod on attempt 3 of 10: test error
E1222 10:23:13.287607       1 main.go:809] Error getting pod on attempt 4 of 10: test error
E1222 10:23:18.290680       1 main.go:809] Error getting pod on attempt 5 of 10: test error
I1222 10:23:23.313543       1 main.go:833] Pod label updated: my-release-nginx-ingress-controller-4db48

Behaviour when can't update pod for first N attempts and then succeeds:

E1222 10:24:08.009645       1 main.go:829] Error updating pod with labels on attempt 1 of 10: test error
E1222 10:24:13.035016       1 main.go:829] Error updating pod with labels on attempt 2 of 10: test error
I1222 10:24:18.058095       1 main.go:833] Pod label updated: my-release-nginx-ingress-controller-2brmb

Confirmed that labels are updated correctly after failures.

This also takes the update out of the hot path so should slightly reduce startup time.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@oseoin oseoin linked an issue Dec 22, 2023 that may be closed by this pull request
Copy link

codecov bot commented Dec 22, 2023

Codecov Report

Attention: 32 lines in your changes are missing coverage. Please review.

Comparison is base (6aca0be) 52.13% compared to head (a1551e2) 52.08%.

Files Patch % Lines
cmd/nginx-ingress/main.go 0.00% 32 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4835      +/-   ##
==========================================
- Coverage   52.13%   52.08%   -0.05%     
==========================================
  Files          60       60              
  Lines       17368    17376       +8     
==========================================
- Hits         9054     9050       -4     
- Misses       8000     8010      +10     
- Partials      314      316       +2     

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

@oseoin oseoin marked this pull request as ready for review December 22, 2023 11:17
@oseoin oseoin requested a review from a team as a code owner December 22, 2023 11:17
@jjngx jjngx requested a review from a team December 22, 2023 11:23
@oseoin oseoin merged commit ad36890 into main Dec 22, 2023
73 checks passed
@oseoin oseoin deleted the 4833-ic-unable-to-update-pod-labels-intermittently branch December 22, 2023 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done 🚀
Development

Successfully merging this pull request may close these issues.

IC unable to update pod labels intermittently
4 participants