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

Add IP garbage collector and cnictl command line tool #13

Closed
fioncat opened this issue Mar 6, 2023 · 0 comments
Closed

Add IP garbage collector and cnictl command line tool #13

fioncat opened this issue Mar 6, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@fioncat
Copy link
Member

fioncat commented Mar 6, 2023

Quo

During our daily work, we found that some cases may cause Secondary IP leakage:

  • cni was killed when it handled an IP which has not yet been persisted.
  • Failed to release IP.
  • Bugs.

These IPs are not bound to any Pod and can never be used again. We need a garbage collector to collect and release them.

STW

During the execution of gc, any IP allocation and release should be blocked, otherwise the IP in the intermediate state may be released by mistake. That is so called, Stop The World.

  • For node without ipamd, we can use filelock to ensure that gc and cni are mutually exclusive.
  • For node who has ipamd, the gc can be added to ipamd's main loop to implement stw.

Trigger

We have two ways to trigger gc:

  • Triggered by cnictl clean ip command manually.
  • Triggered by ipamd schedully (default per day).

cnictl

The commands list for cnictl:

  • cnictl status ip: Show the number of IPs used by Pods, pre-allocated by ipamd, and idle to be recycled. The IPs will be printed too with -a.
  • cnictl logs: Show cni logs (/var/log/cnivpc.log).
  • cnictl clean ip: Clean unused IPs. If the current node has ipamd, it will call ipamd (grpc) to clean.
@fioncat fioncat added the enhancement New feature or request label Mar 6, 2023
@fioncat fioncat self-assigned this Mar 6, 2023
@fioncat fioncat pinned this issue Mar 6, 2023
@fioncat fioncat changed the title Add IP garbage collector and cnictl command tool Add IP garbage collector and cnictl command line tool Mar 6, 2023
@fioncat fioncat linked a pull request Mar 7, 2023 that will close this issue
@fioncat fioncat closed this as completed Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant