Skip to content

Linux Network Devices #4538

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Linux Network Devices #4538

wants to merge 3 commits into from

Conversation

aojea
Copy link

@aojea aojea commented Nov 21, 2024

Implementation of opencontainers/runtime-spec#1271

It implements the new proposal to the OCI spec to be able to specify Network Devices that get attached/detached from the containers

@aojea aojea force-pushed the netdevices branch 2 times, most recently from 07d3b0b to 3833056 Compare December 2, 2024 15:40
Copy link

@kad kad left a comment

Choose a reason for hiding this comment

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

LGTM. We are also interested in this use case for our accelerator devices.

@aojea aojea force-pushed the netdevices branch 2 times, most recently from 67f12e0 to d114afe Compare December 12, 2024 07:15
@aojea aojea force-pushed the netdevices branch 2 times, most recently from ec90a02 to f4f5d02 Compare December 20, 2024 12:11
@aojea aojea force-pushed the netdevices branch 2 times, most recently from 735f9d5 to ce1f612 Compare January 14, 2025 09:47
@aojea aojea force-pushed the netdevices branch 4 times, most recently from 6262c5e to c530772 Compare February 6, 2025 09:55
@aojea aojea force-pushed the netdevices branch 5 times, most recently from 4380e86 to f53d263 Compare February 10, 2025 21:27
@rata
Copy link
Member

rata commented Feb 25, 2025

@aojea friendly reminder that this should be ready soon, we are cutting 1.3.0-rc.1 soon (maybe this week). The spec part is still not sure when it will be merged?

@aojea
Copy link
Author

aojea commented Apr 28, 2025

Not sure why CI is failing only in this PR. It seems to skip on rootless... :-/

but it seems it still tries to setup the interfaces and network namespaces ... I added a check to ignore those steps if is not root on the setup and teardown


# verify the interface is still present in the network namespace
ip netns exec "$ns_name" ip address show dev ctr_dummy0
[ "$status" -eq 0 ]
Copy link
Contributor

Choose a reason for hiding this comment

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

Which $status are you checking here?

Copy link
Author

Choose a reason for hiding this comment

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

IIUIC the status is cascaded

# ip netns exec ns1 ip addr show dev ctr0
Device "ctr0" does not exist.
# echo $?
1

Comment on lines 209 to 211
[[ "$output" == *"$global_ip"* ]]
[[ "$output" == *"ether $mac_address"* ]]
[[ "$output" == *"mtu $mtu_value"* ]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question for $output.

Copy link
Author

Choose a reason for hiding this comment

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

it gets the output of the command executed inside the namespace

Comment on lines 89 to 90
# tell runc which network namespace to use
update_config '(.. | select(.type? == "network")) .path |= "'"$ns_path"'"'
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you move it close to other update_config (just for the sake of readability)?

Copy link
Author

Choose a reason for hiding this comment

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

done

@aojea
Copy link
Author

aojea commented Apr 29, 2025

folks apologies for leaving this half way yesterdat, but we had a total blackout in spain and portugal and I lost connection until today :)

@aojea aojea force-pushed the netdevices branch 5 times, most recently from 08f6e2f to eaf2d7a Compare April 29, 2025 07:45
@aojea
Copy link
Author

aojea commented Apr 29, 2025

The rootless jobs fail when I move the network namespace logic to the setup block, it is not able to run the test despite is skipped ... I tried different things without success, so I encapsulated the create_netns logic in a function and moves it inside the test block, so is skipped correctly

@aojea aojea force-pushed the netdevices branch 2 times, most recently from 954978a to e87aa5e Compare May 9, 2025 07:23
@aojea
Copy link
Author

aojea commented May 9, 2025

kindly ping @kolyshkin @rata , please let me know what is missing

@rata
Copy link
Member

rata commented May 13, 2025

Sorry, so far you are not missing anything, I'm quite overloaded with lot of stuff now and I didn't manage to get back to this. It was very close last time I checked, I guess it's ready or almost. I can try to have a look next week.

Sorry again for the delay, it's quite hard with lot of deadlines in these weeks for me to find the time. But For sure I'll have the time for this is included in 1.4, don't worry about that :)

aojea added 2 commits May 14, 2025 06:29
Signed-off-by: Antonio Ojea <aojea@google.com>
Signed-off-by: Antonio Ojea <aojea@google.com>
@aojea aojea force-pushed the netdevices branch 2 times, most recently from cc520e0 to 5e36d0b Compare May 16, 2025 09:54
@aojea
Copy link
Author

aojea commented May 16, 2025

updated the code to handle the change on the vishvananda library and recover the previous behavior of the library, do not think we need to add retries as they were not needed before

ref vishvananda/netlink#1018

Implement support for passing Linux Network Devices to the container
network namespace.

The network device is passed during the creation of the container,
before the process is started.

It implements the logic defined in the OCI runtime specification.

Signed-off-by: Antonio Ojea <aojea@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants