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

cnitool: refactor, add GC, convert to workspace #1076

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

squeed
Copy link
Member

@squeed squeed commented Mar 22, 2024

This refactors cnitool to be a modern cobra-style program. It also adds STATUS and GC support.

Finally it uses go workspaces to allow for separate go.mod files.

This refactors cnitool to be a modern cobra-style program. It also adds
STATUS and GC support.

Finally it uses go workspaces to allow for separate `go.mod` files.

Signed-off-by: Casey Callendrello <[email protected]>
for _, netns := range args[1:] {
pair := strings.Split(netns, ":")
ifname := "eth0"
if len(pair) > 1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this scenario - e.g. /var/run/netns/arandompod:ens4 - you also need to update the value of the netns, otherwise, you'd be computing the container ID from the full string, which also has the interface name in.


validAttachments = append(validAttachments, types.GCAttachment{
IfName: ifname,
ContainerID: containerID(netns),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong AFAIU - you're checking the containerID based on the "full" netns value, which can include the name of the interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants