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 b713dcc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 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())
)
control_plane_ingress_ip = __salt__["metalk8s_network.get_control_plane_ingress_ip"]()
mine_control_plane_ips = list(mine_ret.values())
if control_plane_ingress_ip in mine_control_plane_ips:
mine_control_plane_ips.remove(control_plane_ingress_ip)

return [control_plane_ingress_ip] + sorted(mine_control_plane_ips)
3 changes: 0 additions & 3 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 Expand Up @@ -318,7 +316,6 @@ get_control_plane_ingress_external_ips:
result:
- 1.1.1.2
- 1.1.1.1
- 1.1.1.2
- 1.1.1.3

# 6. Multi node, one master node not yet in mine
Expand Down

0 comments on commit b713dcc

Please sign in to comment.