Skip to content
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
7 changes: 4 additions & 3 deletions cni-plugin/pkg/ipamplugin/ipam_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,6 @@ func cmdDel(args *skel.CmdArgs) error {
})

logger.Info("Releasing address using handleID")
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 90*time.Second)
defer cancel()

// Acquire a best-effort host-wide lock to prevent multiple copies of the CNI plugin trying to assign/delete
// concurrently. ReleaseXXX is concurrency safe already but serialising the CNI plugins means that
Expand All @@ -506,6 +503,10 @@ func cmdDel(args *skel.CmdArgs) error {
unlock := acquireIPAMLockBestEffort(conf.IPAMLockFile)
defer unlock()

ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 90*time.Second)
defer cancel()

if err := calicoClient.IPAM().ReleaseByHandle(ctx, handleID); err != nil {
if _, ok := err.(errors.ErrorResourceDoesNotExist); !ok {
logger.WithError(err).Error("Failed to release address")
Expand Down
Loading