-
Notifications
You must be signed in to change notification settings - Fork 240
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: fixing HNS network already exist error in Stateless CNI #3297
base: master
Are you sure you want to change the base?
Conversation
bdaa36f
to
859f4e4
Compare
logger.Info("Successfully created hcn network with response", zap.Any("hnsResponse", hnsResponse)) | ||
} else { | ||
if strings.Contains(err.Error(), "already exists") { | ||
// fetch the network name again since the parallel CNI Add call has created the HNS network |
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.
lets add a log printing err.Error() before calling get hns network
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.
done
network/network_windows.go
Outdated
if err != nil { | ||
return nil, fmt.Errorf("Failed to get hcn network: %s due to error: %v", hcnNetwork.Name, err) | ||
} | ||
logger.Info("Successfully fetched hcn network with response", zap.Any("hnsResponse", hnsResponse)) |
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.
since you are logging whole struct, lets make sure its not printing any byte array
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.
Printed hnsreponse.ID instead in new commit
945e04f
to
22e2cc8
Compare
22e2cc8
to
db1732b
Compare
Reason for Change:
This PR fix an issue in stateless CNI where the "HNS network already exists" error was not being handled correctly.
Since Stateless CNI add calls work in parallel, it is possible that two add process make API calls to create HNS netwrok at the same time and one of them fails since the other one successfully created the network (HNS process calls sequentially). In that case the second process should not exit in error and instead fetch the HNS network that was created by the first process and continue with the add call.
Notes: