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

Adding CNI async delete to old API for cilium #2302

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions azure-ipam/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,19 @@ func (p *IPAMPlugin) CmdDel(args *cniSkel.CmdArgs) error {
err = p.cnsClient.ReleaseIPAddress(context.TODO(), ipconfigReq)

if err != nil {
p.logger.Error("Failed to release IP address to CNS using ReleaseIPAddress", zap.Error(err), zap.Any("request", ipconfigReq))
return cniTypes.NewError(ErrRequestIPConfigFromCNS, err.Error(), "failed to release IP address from CNS using ReleaseIPAddress")
if errors.As(err, &connectionErr) {
p.logger.Info("Failed to release IP address from CNS due to connection failure, saving to watcher to delete")
addErr := fsnotify.AddFile(args.ContainerID, args.ContainerID, watcherPath)
if addErr != nil {
p.logger.Error("Failed to add file to watcher", zap.String("containerID", args.ContainerID), zap.Error(addErr))
return cniTypes.NewError(cniTypes.ErrTryAgainLater, addErr.Error(), fmt.Sprintf("failed to add file to watcher with containerID %s", args.ContainerID))
} else {
p.logger.Info("File successfully added to watcher directory")
}
} else {
p.logger.Error("Failed to release IP address to CNS using ReleaseIPAddress", zap.Error(err), zap.Any("request", ipconfigReq))
return cniTypes.NewError(ErrRequestIPConfigFromCNS, err.Error(), "failed to release IP address from CNS using ReleaseIPAddress")
}
}
} else if errors.As(err, &connectionErr) {
p.logger.Info("Failed to release IP addresses from CNS due to connection failure, saving to watcher to delete")
Expand Down