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

fix: clear stack watchers map when lost leader lease #5123

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

emosbaugh
Copy link
Contributor

@emosbaugh emosbaugh commented Oct 15, 2024

Description

When the lease is lost the context is cancelled and the stack processing loop exits ("Stack done"). Once the lease is re-aquired the stacks never get created because the map to prevent them from getting added twice is not cleared.

https://github.com/k0sproject/k0s/pull/5123/files#diff-76a26da950291d89ea652adeec6f6108d7ef34165e027972910c934bbdcce264R206-R210

Fixes #5122

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Manual test
  • Auto test added

Checklist:

  • My code follows the style guidelines of this project
  • My commit messages are signed-off
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@emosbaugh emosbaugh force-pushed the issue-5122-re-init-stack-watchers-when-leader-lease-reaquired branch from 3be7e7c to b9fd78e Compare October 15, 2024 20:35
@emosbaugh
Copy link
Contributor Author

This is still a work in progress. I intend to add a test.

@emosbaugh emosbaugh force-pushed the issue-5122-re-init-stack-watchers-when-leader-lease-reaquired branch from 6c1bba3 to 4074da0 Compare October 16, 2024 17:25
@emosbaugh
Copy link
Contributor Author

This is still a work in progress. I intend to add a test.

I have added a test. The test takes about 5 seconds as im beholden to the debouncing of the stack applier.

@emosbaugh emosbaugh force-pushed the issue-5122-re-init-stack-watchers-when-leader-lease-reaquired branch 6 times, most recently from c0aebe6 to 63a6c10 Compare October 16, 2024 20:52
@emosbaugh emosbaugh force-pushed the issue-5122-re-init-stack-watchers-when-leader-lease-reaquired branch from 63a6c10 to 499fe61 Compare October 16, 2024 20:54
@emosbaugh emosbaugh marked this pull request as ready for review October 16, 2024 21:23
@emosbaugh emosbaugh requested review from a team as code owners October 16, 2024 21:23
}

// Run runs the Manager
func (m *Manager) Start(_ context.Context) error {
m.log.Debug("Starting")
Copy link
Contributor Author

@emosbaugh emosbaugh Oct 16, 2024

Choose a reason for hiding this comment

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

this was largely lifted from the ExtensionsController

@twz123
Copy link
Member

twz123 commented Oct 17, 2024

Can you maybe check if that's fixed by #5062, too?

@emosbaugh
Copy link
Contributor Author

Can you maybe check if that's fixed by #5062, too?

Yes. I will checkout your branch and run the tests from mine. They exhibit the issue prior to my change.

@emosbaugh
Copy link
Contributor Author

Can you maybe check if that's fixed by #5062, too?

Yes. I will checkout your branch and run the tests from mine. They exhibit the issue prior to my change.

Your change also solves the issue. I've created a pull request into your branch with my test from this one. Feel free to close this pr.

twz123#134

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.

When leader lease is lost applier manager is not restarted
2 participants