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

Make sure kube related nodes add also isAlias for remote endpoints fo… #602

Merged
merged 1 commit into from
Jul 23, 2024
Merged
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
6 changes: 6 additions & 0 deletions src/python/SiteFE/PolicyService/policyService.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def __init__(self, config, sitename):
self.currentActive = getActiveDeltas(self)
self.newActive = {}
self._refreshHosts()
self.kube = False

def refreshthread(self):
"""Call to refresh thread for this specific class and reset parameters"""
Expand All @@ -91,6 +92,7 @@ def refreshthread(self):
self.scannedRoutes = []
self.newActive = {}
self._refreshHosts()
self.kube = False

def _refreshHosts(self):
"""Refresh all hosts information"""
Expand Down Expand Up @@ -228,10 +230,12 @@ def parseModel(self, gIn):
if hostDict.get("hostinfo", {}).get("KubeInfo", {}).get("isAlias"):
self.logger.info("Parsing Kube requests from model")
for intf, _val in hostDict["hostinfo"]["KubeInfo"]["isAlias"].items():
self.kube = True
connID = f"{self.prefixes['site']}:{host}:{intf}"
out.setdefault("kube", {})
connOut = out["kube"].setdefault(str(connID), {})
self.parseL2Ports(gIn, URIRef(connID), connOut)
self.kube = False
return out

def getRoute(self, gIn, connID, returnout):
Expand Down Expand Up @@ -436,6 +440,8 @@ def parsePorts(self, gIn, connectionID, connOut, hostsOnly=False):
# If hostsOnly is set - this already parses a subInterface of port;
# which usually is a isAlias. It should be parsed on it's own in another
# scan - as it needs to be in correct layout. (IsAlias defined by modeling, no force add)
if self.kube and (not port.startswith(self.prefixes['site'])):
connOut["isAlias"] = str(port)
if not self.hostsOnly(port):
continue
if port not in self.bidPorts and port not in self.scannedPorts:
Expand Down
Loading