From 7f97ec1e0fc8230f6b308d9e5b3c09cee898117e Mon Sep 17 00:00:00 2001 From: Andrew Bonney Date: Tue, 27 Aug 2024 14:21:30 +0100 Subject: [PATCH] Add env var so proxy can work when floating IPs are in use --- magnum_cluster_api/proxy/structs.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/magnum_cluster_api/proxy/structs.py b/magnum_cluster_api/proxy/structs.py index f05807d9..9a5e87f8 100644 --- a/magnum_cluster_api/proxy/structs.py +++ b/magnum_cluster_api/proxy/structs.py @@ -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)