-
Notifications
You must be signed in to change notification settings - Fork 749
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
Return success from CNI DEL when IPAMD is unreachable #2350
Conversation
for _, allocation := range checkpoint.Allocations { | ||
if err := ds.validateAllocationByPodVethExistence(allocation, hostNSLinks); err != nil { | ||
ds.log.Warnf("ignore IP allocation for %v:%v,%v due to %v", allocation.ContainerID, allocation.IPv4, allocation.IPv6, err) | ||
ds.log.Warnf("stale IP allocation for ID(%v): IPv4(%v), IPv6(%v) due to %v", allocation.ContainerID, allocation.IPv4, allocation.IPv6, err) | ||
staleAllocations = append(staleAllocations, allocation) |
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.
If we cleanup resources and then call IPAMD then this check wouldn't be needed..
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.
Right, but we can only do that if the pod was created by v1.12.1+. It would be great to remove this overhead in the future, but in the common case, there should never be any stale allocations to clean up
38f992d
to
71df0fd
Compare
508364a
to
8d448c7
Compare
On IPAMD startup, prune IP rules for stale allocations
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.
/approve
approving given we'll do the mentioned refactor as follow up.
What type of PR is this?
bug
Which issue does this PR fix:
#2331
What does this PR do / Why do we need it:
This PR modifies the VPC CNI pod deletion logic to return no error to the container-runtime when IPAMD is unreachable. This is needed for three primary reasons:
CNI Changes:
As before, the CNI will try to delete non-branch-ENI pods using PrevResult when IPAMD is not reachable. The difference is that CNI will now return no error in this case. Note that PrevResult will only be available for pods created with VPC CNI v1.12.1+. For pods created before this, IP rules will be leaked, and it is IPAMD's responsibility to cleanup these rules when it starts again.
IPAMD Changes:
On init, IPAMD identifies stale allocations and prunes IP rules for these stale allocations. IPAMD cannot be sure if CNI was able to prune those rules before the pod was deleted. Also, IPAMD does an additional state file write after pruning entries.
Misc:
I also did some refactoring of network utilities to avoid code duplication.
If an issue # is not available please add repro steps and logs from IPAMD/CNI showing the issue:
N/A
Testing done on this change:
Added unit test coverage for stale IPAM allocations. Manually created a cluster and verified behavior when IPAMD is unreachable, plus upgrade/downgrade scenarios.
Automation added to e2e:
N/A
Will this PR introduce any new dependencies?:
N/A
Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No, Yes
Does this change require updates to the CNI daemonset config files to work?:
No
Does this PR introduce any user-facing change?:
Yes
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.