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 lab hash to Docker networks names #256

Closed
tcaiazzi opened this issue Dec 21, 2023 · 0 comments
Closed

Add lab hash to Docker networks names #256

tcaiazzi opened this issue Dec 21, 2023 · 0 comments

Comments

@tcaiazzi
Copy link
Member

tcaiazzi commented Dec 21, 2023

Description:
The current implementation of DockerLink in Kathará lacks the inclusion of the lab_hash in the names of Docker networks.
This omission can lead to collision domains sharing the same name when multiple network scenarios, run by the same user, collide in the namespace.

@staticmethod
def get_network_name(name: str) -> str:
"""Return the name of a Docker network.
Args:
name (str): The name of a Kathara collision domain.
Returns:
str: The name of the Docker network in the format "|net_prefix|_|username_prefix|_|name|".
If shared collision domains, the format is: "|net_prefix|_|lab_hash|".
"""
username_prefix = "_%s" % utils.get_current_user_name() if not Setting.get_instance().shared_cd else ""
return "%s%s_%s" % (Setting.get_instance().net_prefix, username_prefix, name)

This not only contradicts the model where Link objects have a reference to their lab but also introduces potential issues, as observed in #253.

Proposed Solution:
To resolve this issue and improve the consistency of network naming within the Kathará framework, we need to add the lab_hash in the name of Docker networks.
Then, we need to add an option in the Kathará settings to allow users to share collision domains between the network scenarios (without adding the lab_hash), as we already have for sharing collision domains between users.

@tcaiazzi tcaiazzi self-assigned this Dec 21, 2023
@tcaiazzi tcaiazzi converted this from a draft issue Dec 21, 2023
@tcaiazzi tcaiazzi changed the title Add lab hash to Link Add lab hash to Docker network names Dec 21, 2023
@tcaiazzi tcaiazzi added this to the Release 3.7.1 milestone Dec 21, 2023
@tcaiazzi tcaiazzi changed the title Add lab hash to Docker network names Add lab hash to Docker networks names Dec 21, 2023
tcaiazzi added a commit that referenced this issue Dec 21, 2023
This commit adds the `lab_hash` to Docker networks names and adds an option in the Shared Collision Domain of the `DockerSettingsAddon` to share collision domains between network scenarios of the same user or between different users.
Skazza94 added a commit that referenced this issue Dec 23, 2023
@Skazza94 Skazza94 moved this from In Progress to Done in Kathara Framework Development Board Dec 23, 2023
@Skazza94 Skazza94 self-assigned this Dec 28, 2023
@tcaiazzi tcaiazzi closed this as completed Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants