-
Notifications
You must be signed in to change notification settings - Fork 268
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
Avoid race condition when deleting HNS networks #5336
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brandond
reviewed
Jan 30, 2024
pkg/windows/calico.go
Outdated
@@ -283,7 +283,7 @@ func (c *Calico) Start(ctx context.Context) error { | |||
// generateCalicoNetworks creates the overlay networks for internode networking | |||
func (c *Calico) generateCalicoNetworks() error { | |||
if err := deleteAllNetworks(); err != nil { | |||
return err | |||
return fmt.Errorf("error deleting all networks before bootstrapping calico: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For wrapping errors, the convention in this file seems to be:
Suggested change
return fmt.Errorf("error deleting all networks before bootstrapping calico: %v", err) | |
return errors.Wrap(err, "failed to delete all networks before bootstrapping calico") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are both options present in this file... let me change all to errors.Wrap
brandond
approved these changes
Jan 30, 2024
manuelbuil
force-pushed
the
avoidRaceConditionHNS
branch
2 times, most recently
from
January 31, 2024 10:00
5b20bfa
to
d6180d9
Compare
Signed-off-by: Manuel Buil <mbuil@suse.com>
manuelbuil
force-pushed
the
avoidRaceConditionHNS
branch
from
February 8, 2024 10:02
d6180d9
to
2dd67e9
Compare
thomasferrandiz
approved these changes
Feb 8, 2024
This was referenced Feb 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Check that interfaces are back if the HNS network was deleted before moving to HNS Network creation
Types of Changes
Bugfix
Verification
This is a race condition that really depends on how fast your windows system is able to "recover" the interface after deleting the HNS Network. For me it was impossible to reproduce. However, a basic verification would be:
1 - Deploy rke2 server with calico
2 - Deploy rke2-agent on windows
3 - Once everything is up,
Stop-Service rke2
andC:\usr\local\bin\rke2.exe agent service --delete
4 - Verify that there is at least one HNS Network:
get-hnsnetwork
5 - Start the rke2-agent on windows again with
debug: true
(remember to remove the node first or it will complain about password already there)You should at least see the messages:
And
And it should finally succeed to connect to the server
Testing
Linked Issues
#5335
User-Facing Change
Further Comments