Skip to content

Fixed cert update race condition #342

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

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

Conversation

p-strusiewiczsurmacki-mobica

This PR should fix #341

It adds check for certsMounted channel in reconciliation loop, so reconciliation will only start if all the certs are ready and mounted. This suppresses the irrelevant errors emitted by controller-runtime due to reconciliation loop and runable accessing same secret concurrently.

@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 58.87%. Comparing base (190188d) to head (17a8458).
Report is 74 commits behind head on master.

Files with missing lines Patch % Lines
pkg/rotator/rotator.go 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #342      +/-   ##
==========================================
+ Coverage   57.16%   58.87%   +1.70%     
==========================================
  Files           1        1              
  Lines         572      586      +14     
==========================================
+ Hits          327      345      +18     
+ Misses        181      178       -3     
+ Partials       64       63       -1     
Flag Coverage Δ
unittests 58.87% <91.66%> (+1.70%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

// Continue with reconciliation
case <-r.certsNotMounted:
// Requeue with backoff strategy
return reconcile.Result{Requeue: true, RequeueAfter: 5 * time.Second}, errors.New("certs not mounted, retrying reconciliation")
Copy link

Choose a reason for hiding this comment

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

In the <-r.certsNotMounted case I would return reconcile.Result{}, errors.New("certs not mounted, retrying reconciliation"). For completeness I would also check ctx.Done.

Choose a reason for hiding this comment

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

I've added the check for ctx.Done.

Signed-off-by: Patryk Strusiewicz-Surmacki <patryk-pawel.strusiewicz-surmacki@external.telekom.de>
Co-authored-by: Rita Zhang <rita.z.zhang@gmail.com>
Signed-off-by: Patryk Strusiewicz-Surmacki <137421299+p-strusiewiczsurmacki-mobica@users.noreply.github.com>
Signed-off-by: Patryk Strusiewicz-Surmacki <patryk-pawel.strusiewicz-surmacki@external.telekom.de>
Signed-off-by: Patryk Strusiewicz-Surmacki <patryk-pawel.strusiewicz-surmacki@external.telekom.de>
Signed-off-by: Patryk Strusiewicz-Surmacki <patryk-pawel.strusiewicz-surmacki@external.telekom.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Irrelevant error logs, presumably due to a race condition
4 participants