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

fix deployment with ipv6 management network #396

Merged
merged 1 commit into from
Jan 14, 2025
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
3 changes: 3 additions & 0 deletions sunbeam-python/sunbeam/provider/local/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import ipaddress
import logging

import petname # type: ignore [import-untyped]
Expand Down Expand Up @@ -154,6 +155,8 @@ def get_management_cidr(self) -> str:
def get_clusterd_http_address(self) -> str:
"""Return the address of the clusterd server."""
local_ip = utils.get_local_ip_by_cidr(self.get_management_cidr())
if ipaddress.ip_address(local_ip).version == 6:
local_ip = f"[{local_ip}]"
address = f"https://{local_ip}:{CLUSTERD_PORT}"
return address

Expand Down
10 changes: 10 additions & 0 deletions sunbeam-python/tests/unit/sunbeam/test_clusterd.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ def test_init_step(self, cclient, mocker):
assert result.result_type == ResultType.COMPLETED
init_step.client.cluster.bootstrap.assert_called_once()

def test_init_step_ipv6(self, cclient, mocker):
role = "control"
init_step = ClusterInitStep(cclient, [role], 0, "fd00::/108")
init_step.client = MagicMock()
init_step.fqdn = "node1"
mocker.patch("sunbeam.utils.get_local_ip_by_cidr", return_value="fd00::2")
result = init_step.run()
assert result.result_type == ResultType.COMPLETED
init_step.client.cluster.bootstrap.assert_called_once()

def test_add_node_step(self, cclient):
add_node_step = ClusterAddNodeStep(cclient, name="node-1")
add_node_step.client = MagicMock()
Expand Down
Loading