Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ikethecoder committed Nov 15, 2024
1 parent 76b3849 commit 881fb06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions microservices/gatewayApi/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ def decorated_function(*args, **kwargs):
def mock_keycloak(mocker):
class mock_kc_admin:
def get_group_by_path(path, search_in_subgroups):
print(path)
if path == "/ns/mytest":
return {"id": "g001"}
elif path == "/ns/mytest2":
return {"id": "g002"}
elif path == "/ns/mytest3":
return {"id": "g003"}
else:
return {"id": "g001"}
def get_group(id):
print(id)
if id == "g001":
return {
"attributes": {
Expand Down
5 changes: 2 additions & 3 deletions microservices/gatewayApi/v1/routes/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ def write_config(namespace: str) -> object:
if do_validate_upstreams is None:
do_validate_upstreams = False

log.debug("Validate upstreams %s %s" % (dp, do_validate_upstreams))

validate_upstream(gw_config, ns_attributes, protected_kube_namespaces, do_validate_upstreams)
except Exception as ex:
traceback.print_exc()
Expand Down Expand Up @@ -512,13 +514,10 @@ def validate_upstream(yaml, ns_attributes, protected_kube_namespaces, do_validat


def validate_upstream_host(_host, errors, allow_protected_ns, protected_kube_namespaces, do_validate_upstreams, perm_upstreams):
log = app.logger
host = _host.lower()

restricted = ['localhost', '127.0.0.1', '0.0.0.0']

log.debug("[%s] Upstream validation %s %s" % (_host, do_validate_upstreams, perm_upstreams))

if host in restricted:
errors.append("service upstream is invalid (e1)")
elif host.endswith('svc'):
Expand Down

0 comments on commit 881fb06

Please sign in to comment.