Skip to content

Commit

Permalink
Do not show duplicated IP in CP ingress external IPs list
Browse files Browse the repository at this point in the history
  • Loading branch information
eg-ayoub committed Sep 2, 2024
1 parent 59fe524 commit 8560c2b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 6 additions & 3 deletions salt/_modules/metalk8s_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ def get_control_plane_ingress_external_ips():
f"Unable to get master Control Plane IPs: {mine_ret}"
)

return [__salt__["metalk8s_network.get_control_plane_ingress_ip"]()] + sorted(
list(mine_ret.values())
)
config_control_plane_ip = __salt__["metalk8s_network.get_control_plane_ingress_ip"]()
mine_control_plane_ips = list(mine_ret.values())
if config_control_plane_ip in mine_control_plane_ips:
mine_control_plane_ips.remove(config_control_plane_ip)

return [config_control_plane_ip] + sorted(mine_control_plane_ips)
2 changes: 0 additions & 2 deletions salt/tests/unit/modules/files/test_metalk8s_network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ get_control_plane_ingress_external_ips:
bootstrap: 1.1.1.1
result:
- 1.1.1.1
- 1.1.1.1

# 2. Nominal single node (using non-bootstrap IP)
- cp_ingress_ip_ret: 1.1.1.4
Expand All @@ -284,7 +283,6 @@ get_control_plane_ingress_external_ips:
node-1: 1.1.1.2
node-2: 1.1.1.3
result:
- 1.1.1.1
- 1.1.1.1
- 1.1.1.2
- 1.1.1.3
Expand Down

0 comments on commit 8560c2b

Please sign in to comment.