This is the repository for the Central Application Gateway.
The Central Application Gateway requires Go 1.8 or higher.
To install the Central Application Gateway, follow these steps:
- Clone the repository to your local machine:
git clone git@github.com:kyma-project/kyma.git
- Navigate to the directory with the Central Application Gateway:
cd kyma/components/central-application-gateway
- Build the component:
CGO_ENABLED=0 go build ./cmd/applicationgateway
This section explains how to use the Central Application Gateway.
To start the Central Application Gateway, run this command:
./applicationgateway
The Central Application Gateway has the following parameters:
- disableLegacyConnectivity is the flag for disabling the default legacy mode and enabling the Compass mode. The default value is
false
. - proxyPort is the port that acts as a proxy for the calls from services and Functions to an external solution in the default standalone (legacy) mode. The default port is
8080
. - proxyPortCompass is the port that acts as a proxy for the calls from services and Functions to an external solution in the Compass mode. The default port is
8082
. - externalAPIPort is the port that exposes the API which allows checking the component status. The default port is
8081
. - applicationSecretsNamespace is the Namespace in which the Application secrets used by Central Application Gateway exist. The default Namespace is
kyma-integration
. - requestTimeout is the timeout for requests sent through the Central Application Gateway, expressed in seconds. The default value is
1
. - skipVerify is the flag for skipping the verification of certificates for the proxy targets. The default value is
false
. - requestLogging is the flag for logging incoming requests. The default value is
false
. - proxyTimeout is the timeout for requests sent through the proxy, expressed in seconds. The default value is
10
. - proxyCacheTTL is the time to live of the remote API information stored in the proxy cache, expressed in seconds. The default value is
120
.
The Central Application Gateway exposes:
- an external API implementing a health endpoint for liveness and readiness probes
- an internal API implementing a proxy handler accessible via a service of type ClusterIP
If disableLegacyConnectivity is false
, the proxy API exposes the following endpoint:
{APPLICATION_NAME}/{SERVICE_NAME}/{TARGET_API_PATH}
For instance, if the user registered the cc-occ-commerce-webservices
service in the ec
application using Application Registry, they can send a request to the following URL:
http://central-application-gateway.kyma-system:8080/ec/cc-occ-commerce-webservices/basesites
As a result, the Central Application Gateway:
- Looks for the
cc-occ-commerce-webservices
service in theec
Application CRD and extracts the target URL path along with the authentication configuration - Modifies the request to include the authentication data
- Sends the request to the following path:
{TARGET_URL_EXTRACTED_FROM_APPLICATION_CRD}/basesites
If disableLegacyConnectivity is true
, the proxy API exposes the following endpoint:
{APPLICATION_NAME}/{API_BUNDLE_NAME}/{API_DEFINITION_NAME}/{TARGET_API_PATH}
For instance, if the user registered the cc-occ
API bundle with the commerce-webservices
API definition in the ec
application, they can send a request to the following URL:
http://central-application-gateway.kyma-system:8082/ec/cc-occ/commerce-webservices/basesites
As a result, the Central Application Gateway:
- Looks for the
cc-occ
service and thecommerce-webservices
entry in theec
Application CRD and extracts the target URL path along with the authentication configuration - Modifies the request to include the authentication data
- Sends the request to the following path:
{TARGET_URL_EXTRACTED_FROM_APPLICATION_CRD}/basesites
This section explains the development process.
Prerequisites:
- Mockery 2.0 or higher
To generate mocks, run:
go generate ./...
When adding a new interface to be mocked or when a mock of an existing interface is not being generated, add the following line directly above the interface declaration:
//go:generate mockery --name {INTERFACE_NAME}
This section outlines the testing details.
To run the unit tests, run this command:
go test./...
To learn how you can contribute to this project, see the Contributing document.