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

Kathará 3.5.1 #187

Merged
merged 65 commits into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
23f93f6
More generic env regex (fix #168)
Skazza94 May 17, 2022
3f26501
Merge branch '168-env-regex-match-failure' into develop
Skazza94 May 17, 2022
d441b4e
Lab hash is computed on Lab name if present (#163)
Skazza94 May 30, 2022
a26d5df
Merge branch '163-compute-labhash-from-labname-if-it-is-present' into…
Skazza94 May 30, 2022
a90c16c
Link object has list of connected machines
Skazza94 May 30, 2022
1474ccd
Merge branch 'main' into develop
Skazza94 Jun 5, 2022
6b2561a
Add more Kubernetes Manager tests
Skazza94 Jun 5, 2022
4019538
Update Machine.py (#174)
whatever4711 Jul 6, 2022
cf3195b
Check that specified Docker Images are compatible with host arch (#178)
Skazza94 Jul 22, 2022
4046fda
Merge branch '178-add-architecture-compatibility-check-for-docker-ima…
Skazza94 Jul 22, 2022
1e78263
Add the possibility to specify device in lrestart (#177)
tcaiazzi Jul 22, 2022
fb7e43d
Handle exception in case binaryornot heuristics fail
Skazza94 Jul 22, 2022
0552dae
Test fix
Skazza94 Jul 22, 2022
aa48d86
add lab tests
tcaiazzi Jul 22, 2022
9e8b657
Add unit tests for deploy_lab method of managers
tcaiazzi Jul 26, 2022
3a98e6f
Add deploy_machine and deploy_link methods (#173)
Skazza94 Jul 26, 2022
6db8d03
Add localhost IPv6 mapping in default /etc/hosts
Skazza94 Aug 2, 2022
bbb94d7
Add undeploy_machine and undeploy_link methods (#173)
Skazza94 Aug 3, 2022
13465af
Replace update_lab method with connect_machine_to_link (#173)
Skazza94 Aug 4, 2022
ee3b84d
Merge branch '177-add-to-lrestart-the-possibilty-to-specify-devices' …
tcaiazzi Aug 24, 2022
8b703dd
Add change_link to manager and add unit tests
tcaiazzi Aug 25, 2022
de84915
Fix change_link (#173)
Skazza94 Aug 25, 2022
98f0e52
Add disconnect_from_link (#173)
Skazza94 Aug 26, 2022
1afe5f2
Remove swap + Add --rm to vconfig (#173)
Skazza94 Aug 26, 2022
467ad18
Add method to DockerManager to build a lab from api (#173)
tcaiazzi Aug 31, 2022
f363523
Minor polish (#173)
Skazza94 Sep 1, 2022
581bdd0
get_lab_from_api in KubernetesManager (#173)
Skazza94 Sep 1, 2022
fc11d5c
Add the possibility to disconnect devices in lconfig
tcaiazzi Sep 1, 2022
688ec6f
Fix + add unit tests for get_lab_from_api and update_lab_from_api (#173)
tcaiazzi Sep 1, 2022
a37d14f
Change 'lab' string to 'network scenario'
Skazza94 Sep 1, 2022
aed191c
Fix doc (#173)
tcaiazzi Sep 1, 2022
242161d
fix docstyle
tcaiazzi Sep 1, 2022
6907dad
Fix k8s tests
tcaiazzi Sep 1, 2022
21ddf8c
Merge branch '173-methods-to-manager' into develop
tcaiazzi Sep 1, 2022
96d1191
minor fixes
tcaiazzi Sep 1, 2022
a77ad19
Minor fixes + Polish
Skazza94 Sep 2, 2022
fb3c86f
Add k8s tests for get_lab_from_api
Skazza94 Sep 2, 2022
9004f67
Add custom exceptions (#179)
tcaiazzi Sep 2, 2022
a394295
fix (#179)
tcaiazzi Sep 2, 2022
f028926
Update pydoc with exceptions (#179)
tcaiazzi Sep 2, 2022
b8f3297
Add custom exceptions to unit tests + fix pydocs (#179)
tcaiazzi Sep 5, 2022
36c6f74
Skip k8s ConfigMap deletion if not present
Skazza94 Sep 5, 2022
21e26eb
fix option parser tests
tcaiazzi Sep 5, 2022
2fce681
Merge branch '179-add-custom-exceptions' into develop
tcaiazzi Sep 5, 2022
e1cef32
add get/new machine methods + unit tests (#181)
tcaiazzi Sep 5, 2022
1e86d73
Add get/new link method to Lab + unit tests (#181)
tcaiazzi Sep 5, 2022
e0a3152
fix test (#181)
tcaiazzi Sep 5, 2022
d864b97
Exceptions polish
Skazza94 Sep 5, 2022
f4be5b3
Merge branch '181-add-lab-methods-to-manage-links-and-machines' into …
tcaiazzi Sep 6, 2022
ac9fb87
Change pyuv to point to py3.10 compatible version on git (closes #182)
Skazza94 Sep 6, 2022
67e54fa
Merge branch '182-pyuv-broken-with-python-310x' into develop
Skazza94 Sep 6, 2022
e3506a1
Polish exceptions strings
Skazza94 Sep 6, 2022
ff920c3
Bump version + Changelog (ready to merge)
Skazza94 Sep 6, 2022
c50d76e
Docs update
Skazza94 Sep 6, 2022
cb1eddd
Update README
Skazza94 Sep 6, 2022
8734bf2
Remove Ubuntu Impish build
Skazza94 Sep 8, 2022
63b74f9
Add better error handling for kathara np exceptions (#183)
tcaiazzi Sep 9, 2022
7551574
add unit tests (#183)
tcaiazzi Sep 9, 2022
560641e
Merge branch '183-better-error-handling-kathara-np' into develop
tcaiazzi Sep 9, 2022
0482b3c
Fix cleaning with custom shell (#186)
tcaiazzi Sep 27, 2022
1ac4a18
Merge branch '186-bug-in-cleaning-devices-with-custom-shell' into dev…
tcaiazzi Sep 28, 2022
52dd468
Switch windows 10 build to Python3.10
Skazza94 Sep 29, 2022
e47b965
Fix Dockerfile for Linux-Pkg
tcaiazzi Sep 29, 2022
c26b66f
Fix Dockerfile for Debian releases
tcaiazzi Sep 29, 2022
2477d16
fix AUR dependencies
tcaiazzi Sep 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor fixes + Polish
  • Loading branch information
Skazza94 committed Sep 2, 2022
commit a77ad1936ae09774a172f14ac2c05b60f6dddd7c
4 changes: 2 additions & 2 deletions src/Kathara/manager/docker/DockerMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

# If /etc/hosts is not configured by the user, add the localhost mapping
"if [ ! -s \"/etc/hosts\" ]; then "
"echo '127.0.0.1 localhost' > /etc/hosts;"
"echo '::1 localhost' >> /etc/hosts;"
"echo '127.0.0.1 localhost' > /etc/hosts",
"echo '::1 localhost' >> /etc/hosts",
"fi",

# Give proper permissions to /var/www
Expand Down
26 changes: 18 additions & 8 deletions src/Kathara/manager/docker/DockerManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,13 +503,15 @@ def get_lab_from_api(self, lab_hash: str = None, lab_name: str = None) -> Lab:
host_port = port_data[0]["HostPort"]
device.meta["ports"][(int(host_port), protocol)] = int(guest_port)

# Reassign sysctls directly
device.meta["sysctls"] = container.attrs["HostConfig"]["Sysctls"]

if "none" not in container.attrs["NetworkSettings"]["Networks"]:
for network_name in container.attrs["NetworkSettings"]["Networks"]:
if network_name == "bridge":
device.add_meta("bridged", True)
continue

network = lab_networks[network_name]
link = reconstructed_lab.get_or_new_link(network.attrs["Labels"]["name"])
link.api_object = network
Expand All @@ -527,34 +529,42 @@ def update_lab_from_api(self, lab: Lab) -> None:
running_containers = self.get_machines_api_objects(lab_hash=lab.hash)

deployed_networks = dict(
map(lambda x: (x.name, x), self.get_links_api_objects(lab_hash=lab.hash)))
map(lambda x: (x.name, x), self.get_links_api_objects(lab_hash=lab.hash))
)
for network in deployed_networks.values():
network.reload()

deployed_networks_by_link_name = dict(
map(lambda x: (x.attrs["Labels"]["name"], x), self.get_links_api_objects(lab_hash=lab.hash)))
map(lambda x: (x.attrs["Labels"]["name"], x), self.get_links_api_objects(lab_hash=lab.hash))
)

for container in running_containers:
container.reload()
device = lab.get_or_new_machine(container.labels["name"])
device.api_object = container

# Collision domains declared in the network scenario
static_links = set(device.interfaces.values())
current_links = set(map(lambda x: lab.get_or_new_link(
deployed_networks[x].attrs["Labels"]["name"]),
filter(lambda x: x != "bridge", container.attrs["NetworkSettings"]["Networks"])))

# Collision domains currently attached to the device
current_links = set(
map(lambda x: lab.get_or_new_link(deployed_networks[x].attrs["Labels"]["name"]),
filter(lambda x: x != "bridge", container.attrs["NetworkSettings"]["Networks"]))
)
# Collision domains attached at runtime to the device
dynamic_links = current_links - static_links
# Static collision domains detached at runtime from the device
deleted_links = static_links - current_links

for link in static_links:
if link.name in deployed_networks_by_link_name:
link.api_object = deployed_networks_by_link_name[link.name]

for link in dynamic_links:
link.api_object = deployed_networks_by_link_name[link.name]
device.add_interface(link)

for link in deleted_links:
device.remove_interface(link)
for network in deployed_networks.values():
network.reload()

@privileged
def get_machines_stats(self, lab_hash: str = None, lab_name: str = None, machine_name: str = None,
Expand Down
4 changes: 2 additions & 2 deletions src/Kathara/manager/kubernetes/KubernetesMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@

# If /etc/hosts is not configured by the user, add the localhost mapping
"if [ ! -s \"/etc/hosts\" ]; then "
"echo '127.0.0.1 localhost' > /etc/hosts;"
"echo '::1 localhost' >> /etc/hosts;"
"echo '127.0.0.1 localhost' > /etc/hosts",
"echo '::1 localhost' >> /etc/hosts",
"fi",

# Give proper permissions to /var/www
Expand Down