Here is a brief scheme of routing in cluster:
- The Ingress proxies requests to
api-gateway
(configured iningress.yml
); api-gateway
forwards requests to Spring services as well assave-frontend
(configured inapplication.yml
andWebSecurityConfig.kt
);save-frontend
is a pod that hasnginx
running in it (configured innginx.conf
);- All further routing is configured in
basicRouting
functional component, defined insave-frontend
module.
The Ingress proxies requests to the API Gateway (configured in ingress.yml
).
In Kubernetes, an Ingress is a resource that manages external access to services within the cluster. It acts as a layer of traffic routing and load balancing. Existed ingress configuration defines two routing rules for the Ingress resource.
- paths that start with
/grafana/**
are forwarded tografana
service. - all the other paths
/**
are forwarded toapi-gateway
spring service.
api-gateway
uses Spring Cloud Gateway (configured in application.yml
and WebSecurityConfig.kt
).
api-gateway
acts as a request router and filter for SaveOurTool
.
It forwards requests to specific backend services based on their paths
and performs some necessary filtering and header manipulation to ensure proper communication between the gateway and downstream services.
The routes are defined based on specific URI paths:
/sec/**
is not forwarded anywhere butapi-gateway
'sSecurityInfoController
, which is responsible for/sec/oauth-providers
endpoint/api/sandbox
is forwarded tosave-sandbox
/api/demo
is forwarded tosave-demo
/api/cpg
is forwarded tosave-cpg-demo
/api/**
is forwarded tosave-backend
/neo4j/browser/**
is forwarded toneo4j-browser
- all the remaining requests (including resources requests) are forwarded to
save-frontend
save-frontend
is a pod that has nginx
running in it (configured in nginx.conf
).
An entry point to scripts built from save-frontend
module is index.html
,
so it is required to return it whenever user requests something but not resource.
After save-frontend
pod serves index.html
, scripts are fetched and the remaining routing is done with basicRouting
functional component.
For more info take a look into save-frontend/README.md
The main difference between dev
and prod
cases is that prod
has kubernetes
ingress
, while dev
uses webpack-dev-server
.
webpack-dev-server
starts dev server, that does some routing (for more see dev-server.js
and save-deploy/README.md
).
If none of proxies match, webpack-dev-server
serves the index.html
(historyApiFallback
parameter is used).
webpack-dev-server
is configured in dev-server.js
.