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

Migrate tools veth to new link structs #1523

Merged
merged 8 commits into from
Oct 6, 2023

Conversation

steiler
Copy link
Collaborator

@steiler steiler commented Aug 14, 2023

No description provided.

@steiler steiler requested a review from hellt August 30, 2023 15:03
@steiler steiler marked this pull request as ready for review August 30, 2023 15:03
Copy link
Member

@hellt hellt left a comment

Choose a reason for hiding this comment

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

Hi @steiler
thank your for looking into this depthness of repeated links creation.

When I was reviewing this I couldn't shake off the feeling that we should leverage the existing clab.NewNode function to create nodes for us to later resolve them.

So my approach here was to

  1. create fake nodes that represent the nodes between which the veth pair is to be laid out. The fake nodes are created with c.NewNode existing function, so we don't have to create anything new.

  2. the fake "linux" node is created for a regular endpoint, since it is a good enough to attach a veth. For host and bridge the relevant node kinds are created.

  3. Once the fake nodes are created, we can create a linkBrief link type as if it was passed from the topology in brief format. That way we rely on the same link resolving process, reusing the code paths we use for regular deployment.

return &EndpointGeneric{
Node: node,
IfaceName: iface,
// random name is generated for the endpoint to avoid name collisions
// when it is first deployed in the root namespace
randName: genRandomIfName(),
Link: link,
Copy link
Member

@hellt hellt Sep 30, 2023

Choose a reason for hiding this comment

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

now that I don't quite use link directly in the endpoint, I think this can even be removed...
But maybe it will be useful for smth

@hellt hellt changed the title Migrate tools cmd to new linkstructs Migrate tools veth to new link structs Sep 30, 2023
@hellt hellt force-pushed the migratetoolscmdlinkstructs branch from 2d59084 to ae74bd2 Compare October 6, 2023 15:30
@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Merging #1523 (2d59084) into main (d38bdf3) will decrease coverage by 1.17%.
The diff coverage is 5.21%.

❗ Current head 2d59084 differs from pull request most recent head ae74bd2. Consider uploading reports for the commit ae74bd2 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1523      +/-   ##
==========================================
- Coverage   49.45%   48.29%   -1.17%     
==========================================
  Files         136      132       -4     
  Lines       13231    12607     -624     
==========================================
- Hits         6544     6089     -455     
+ Misses       5956     5840     -116     
+ Partials      731      678      -53     
Files Coverage Δ
clab/config.go 66.91% <ø> (ø)
clab/netlink.go 0.00% <ø> (-25.90%) ⬇️
links/endpoint.go 80.00% <100.00%> (-1.25%) ⬇️
links/endpoint_raw.go 71.73% <100.00%> (-6.31%) ⬇️
links/link_host.go 67.08% <100.00%> (-2.92%) ⬇️
links/link_mgmt-net.go 66.66% <100.00%> (-0.37%) ⬇️
nodes/linux/linux.go 67.85% <100.00%> (ø)
nodes/node.go 56.00% <ø> (ø)
links/link_macvlan.go 10.07% <0.00%> (+0.61%) ⬆️
cmd/tools_veth.go 5.22% <0.00%> (-62.88%) ⬇️

... and 23 files with indirect coverage changes

@hellt hellt merged commit f15864b into srl-labs:main Oct 6, 2023
19 checks passed
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.

None yet

2 participants