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

Is there a way to get notified when new netns is created #77

Open
msherif1234 opened this issue Sep 1, 2023 · 3 comments
Open

Is there a way to get notified when new netns is created #77

msherif1234 opened this issue Sep 1, 2023 · 3 comments

Comments

@msherif1234
Copy link

my application when it starts it detect all available netns by looking at /var/run/netns but while its running if new netns is created my application won't know anything about it and as a result it won't know about links and their attributes

what is the best way to know runtime when netns is created so we can use LinkSubscribeAt() for it ?

@bn222
Copy link

bn222 commented Sep 1, 2023

I believe we can use inotify to watch for creation/deletion events in /var/run/netns

@msherif1234
Copy link
Author

Yeah I added inotify and when netns is created I subscribe for notificatoin using netlink.LinkSubscribeAt but it failed here

@msherif1234
Copy link
Author

msherif1234 commented Mar 6, 2024

cc'd @vishvananda
I have an easy reproducer w/o using k8s or docker

ERRO[0009] can't subscribe to links netns NS(16: 25, 58164)  component=ifaces.Watcher error="failed to set into network namespace 16 while creating netlink socket: invalid argument"

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

No branches or pull requests

2 participants