Skip to content

Commit

Permalink
Add env var so proxy can work when floating IPs are in use
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbonney committed Aug 27, 2024
1 parent d32869b commit 7f97ec1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions magnum_cluster_api/proxy/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,24 @@ def from_openstack_cluster(

# NOTE(mnaser): If the API server floating IP is disabled, we don't
# need to proxy it.
if spec.get("disableAPIServerFloatingIP", False) is False:
if (
os.getenv("PROXY_ALWAYS", 0) == 0
and spec.get("disableAPIServerFloatingIP", False) is False
):
return None

status = cluster.obj.get("status", {})

network_id = status.get("network", {}).get("id")
internal_ip = status.get("apiServerLoadBalancer", {}).get("internalIP")

if network_id is None:
LOG.debug("No network ID found for cluster %s", cluster.name)
return

internal_ip = status.get("apiServerLoadBalancer", {}).get("internalIP")
if internal_ip is None:
LOG.debug("No internal IP found for cluster %s", cluster.name)
return

namespaces = [n for n in netns.listnetns() if n.endswith(network_id)]
if len(namespaces) == 0:
LOG.debug("No namespaces found for network %s", network_id)
Expand Down

0 comments on commit 7f97ec1

Please sign in to comment.