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 network aliases to node #2256

Merged
merged 2 commits into from
Oct 31, 2024
Merged

Add network aliases to node #2256

merged 2 commits into from
Oct 31, 2024

Conversation

mzagozen
Copy link
Contributor

A node may have additional network aliases defined in the topology file, like so:

topology:
  nodes:
    srl1:
      kind: srl
      aliases:
        - srl1-alias1

This is directly influenced by docker-compose
aliases (https://docs.docker.com/reference/compose-file/services/#aliases). The difference is that containerlab aliases are defined on a per-node basis, not per-network.

A node may have additional network aliases defined in the topology file, like so:

```yaml
topology:
  nodes:
    srl1:
      kind: srl
      aliases:
        - srl1-alias1
```

This is directly influenced by docker-compose
aliases (https://docs.docker.com/reference/compose-file/services/#aliases).
The difference is that containerlab aliases are defined on a per-node
basis, not per-network.
@hellt
Copy link
Member

hellt commented Oct 25, 2024

thanks @mzagozen
what is the use case for the name alias?

@mzagozen
Copy link
Contributor Author

thanks @mzagozen what is the use case for the name alias?

We have a controller in our topology where the tenant is determined by the domain name used to connect to the controller. So we set up aliases like tenant-1.example.com, tenant-2.example.com. We then use these names from our NMS which is also deployed with containerlab in the same network. Of course this could be solved by adding /etc/hosts entries in the NMS container, but since the container runtime already supports aliases, it feels better to use it?

@hellt
Copy link
Member

hellt commented Oct 25, 2024

thnx @mzagozen
no, I agree that they are useful, I was just making sure you know that the nodes are accessible by their shortnames among each other.
But since you have custom expected fqdns, then I can see how having those is beneficial.
Thank you for the PR, I will get to it next week

@hellt hellt self-assigned this Oct 31, 2024
@hellt hellt merged commit 5c25be6 into srl-labs:main Oct 31, 2024
62 of 65 checks passed
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Project coverage is 51.16%. Comparing base (9e96472) to head (a4623a7).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
types/topology.go 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2256      +/-   ##
==========================================
- Coverage   51.18%   51.16%   -0.03%     
==========================================
  Files         172      172              
  Lines       16689    16696       +7     
==========================================
  Hits         8542     8542              
- Misses       7235     7241       +6     
- Partials      912      913       +1     
Files with missing lines Coverage Δ
clab/config.go 66.75% <100.00%> (+0.08%) ⬆️
runtime/docker/docker.go 68.98% <100.00%> (+0.03%) ⬆️
runtime/podman/util.go 81.27% <100.00%> (ø)
types/node_definition.go 95.10% <100.00%> (+0.10%) ⬆️
types/types.go 62.88% <ø> (ø)
types/topology.go 68.69% <80.00%> (+0.13%) ⬆️

... and 2 files with indirect coverage changes

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