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

Scaleway: Force on-link: true for static networks (#5523) #5654

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion cloudinit/sources/DataSourceScaleway.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,11 @@ def network_config(self):
if ip["address"] == self.ephemeral_fixed_address:
ip_cfg["dhcp4"] = True
# Force addition of a route to the metadata API
route = {"to": "169.254.42.42/32", "via": "62.210.0.1"}
route = {
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
}
if "routes" in ip_cfg.keys():
ip_cfg["routes"] += [route]
else:
Expand Down
24 changes: 20 additions & 4 deletions tests/unittests/sources/test_scaleway.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,11 @@ def test_ipmob_primary_ipv4_config_ok(self, m_get_cmdline, fallback_nic):
"ethernets": {
fallback_nic.return_value: {
"routes": [
{"to": "169.254.42.42/32", "via": "62.210.0.1"}
{
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
}
],
"dhcp4": True,
},
Expand Down Expand Up @@ -903,7 +907,11 @@ def test_ipmob_additional_ipv4_config_ok(
fallback_nic.return_value: {
"dhcp4": True,
"routes": [
{"to": "169.254.42.42/32", "via": "62.210.0.1"}
{
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
}
],
"addresses": ("20.20.20.20/32",),
},
Expand Down Expand Up @@ -983,7 +991,11 @@ def test_ipmob_primary_ipv4_v6_config_ok(
fallback_nic.return_value: {
"dhcp4": True,
"routes": [
{"to": "169.254.42.42/32", "via": "62.210.0.1"},
{
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
},
{
"via": "fe80::ffff:ffff:ffff:fff1",
"to": "::/0",
Expand Down Expand Up @@ -1034,7 +1046,11 @@ def test_ipmob_primary_ipv6_v4_config_ok(
"via": "fe80::ffff:ffff:ffff:fff1",
"to": "::/0",
},
{"to": "169.254.42.42/32", "via": "62.210.0.1"},
{
"on-link": True,
"to": "169.254.42.42/32",
"via": "62.210.0.1",
},
],
"addresses": ("2001:aaa:aaaa:a:aaaa:aaaa:aaaa:1/64",),
},
Expand Down