Skip to content

Conversation

@wingsofovnia
Copy link
Contributor

This PR addresses the issue of orphaned secrets created during reconciliation retries #83 by implementing deterministic labeling for account secrets #60.

Problem

When the NAuth controller reconciles a new Account CR, it generates account keys and creates Kubernetes secrets before uploading the JWT to NATS. If the NATS upload fails (e.g., NATS is temporarily unavailable), the reconciliation loop retries. Since the account.nauth.io/id label hasn't been applied to the CR yet, the controller would generate a new ID and a new set of secrets on every retry, leading to a build-up of orphaned secrets.

Solution

The controller now uses the account name as a deterministic identifier to locate existing secrets before creating new ones. By labeling secrets with account.nauth.io/name, the manager can recover and reuse previously generated keys even if the reconciliation process was interrupted.

Fixes #60
Closes #83

@wingsofovnia wingsofovnia requested a review from a team as a code owner January 17, 2026 12:21
Copy link
Collaborator

@thobiaskarlsson thobiaskarlsson left a comment

Choose a reason for hiding this comment

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

Looks good but I have a couple of comments I'd like you to consider before approving.

@wingsofovnia
Copy link
Contributor Author

@thobiaskarlsson, thank you for the review. Ready for a second pass!

thobiaskarlsson
thobiaskarlsson previously approved these changes Feb 4, 2026
Copy link
Collaborator

@thobiaskarlsson thobiaskarlsson left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for contributing! You need to sign-off the commit(s) though.

Copy link
Contributor

@henriropp henriropp left a comment

Choose a reason for hiding this comment

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

Thanks. Just a minor finding in the seed lookup from secrets. Probably not very frequent scenario...

Signed-off-by: Illia Ovchynnikov <illia.ovchynnikov@gmail.com>
@wingsofovnia
Copy link
Contributor Author

wingsofovnia commented Feb 5, 2026

You need to sign-off the commit(s) though - @thobiaskarlsson

Done!

Just a minor finding in the seed lookup from secrets - @henriropp

Fixed too.

Thank you guys!

Are there any plans for the next release anytime soon (last one was more than 3 weeks ago)?

@thobiaskarlsson
Copy link
Collaborator

You need to sign-off the commit(s) though - @thobiaskarlsson

Done!

Just a minor finding in the seed lookup from secrets - @henriropp

Fixed too.

Thank you guys!

Are there any plans for the next release anytime soon (last one was more than 3 weeks ago)?

Yes, we can absolutely do a new release. I was hoping for #116 to be merged soon so that we can get both features in the same release. @aleksanderaleksic, what are your thoughts on this, will you be able to fix the PR within the upcoming days?

@wingsofovnia
Copy link
Contributor Author

I was hoping for #116 to be merged soon so that we can get both features in the same release - @thobiaskarlsson

#116 feels like a major change worth a v0.6.0 when it's ready. Looking forward to it!
If we could release v0.5.2 with bugfixes and small improvements that are already in the mainstream (perhaps this bugfix included too) would be great. I had to deal with a nauth fork for while now because of some of the fixes needed 🥲

@aleksanderaleksic
Copy link

Yes, we can absolutely do a new release. I was hoping for #116 to be merged soon so that we can get both features in the same release. @aleksanderaleksic, what are your thoughts on this, will you be able to fix the PR within the upcoming days?

@thobiaskarlsson I will work on it today and try to get it ready for another round of reviews.

@aleksanderaleksic
Copy link

#116 feels like a major change worth a v0.6.0 when it's ready. Looking forward to it! If we could release v0.5.2 with bugfixes and small improvements that are already in the mainstream (perhaps this bugfix included too) would be great. I had to deal with a nauth fork for while now because of some of the fixes needed 🥲

@wingsofovnia I agree that #116 is a new minor release, we are introducing a new concept even though its backwards-compatible.

@wingsofovnia
Copy link
Contributor Author

@thobiaskarlsson can we merge this PR or there is a reason to keep it open?

@thobiaskarlsson thobiaskarlsson merged commit 5a731a4 into WirelessCar:main Feb 8, 2026
5 checks passed
@thobiaskarlsson
Copy link
Collaborator

I was hoping for #116 to be merged soon so that we can get both features in the same release - @thobiaskarlsson

#116 feels like a major change worth a v0.6.0 when it's ready. Looking forward to it! If we could release v0.5.2 with bugfixes and small improvements that are already in the mainstream (perhaps this bugfix included too) would be great. I had to deal with a nauth fork for while now because of some of the fixes needed 🥲

Yes, I'll release the current changes as a patch release. 👍 Great work!

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.

NAuth creates orphaned account secrets if NATS is unavailable Add account name as label in root + sign keys

4 participants