Kong routes management migration
- 1 Overview
- 2 Transition process
- 2.1 Prerequisites
- 2.2 Steps
- 2.3 Verification
Overview
There has been a change in the way how Eureka manages routes in Kong.
The goal of the change is to reduce number of routes in Kong. This is achieved by making routes non-tenant-specific - thus avoiding duplication of same routes per tenant.
Since routes are now not tenant-specific, they can be created/deleted immediately when module discovery information is added/deleted - which is why the logic for managing Kong routes is now in mgr-applications microservice.
Previously routes were created/deleted in Kong on entitling/unentitling application for a specific tenant - and that is why logic for managing Kong routes was in mgr-tenant-entitlements microservice.
Relevant Jira issues:
MGRAPPS-35: Reduce number of redundant routes in KongIn Review
MGRENTITLE-81: Reduce number of redundant routes in KongIn Review
Transition process
Prerequisites
Deploy mgr-applications version 2.0.0 or later.
Enable feature toggle in mgr-applications by setting configuration property routemanagement.enable to true, e.g. via environment variable ROUTEMANAGEMENT_ENABLE = true
Disable feature toggle in mgr-tenant-entitlements by setting configuration property application.kong.enabled to false, e.g. via environment variable APPLICATION_KONG_ENABLED = false
Steps
Disable Kong routes management in mgr-tenant-entitlements via env variable APPLICATION_KONG_ENABLED = false
Enable Kong routes management in mgr-applications via env variable ROUTEMANAGEMENT_ENABLE = true
Get all module IDs from discovery information: execute HTTP
GET
on<mgr-applications>/modules/discovery?limit=500
, pickid
field fromdiscovery
array entries, mind the possible pagination - get next pages if there are any.Delete discovery information per module: execute HTTP
DELETE
on<mgr-applications>/modules/<module-id>/discovery
wheremodule-id
is a module id from previous step. Execute such HTTP request for all modules. Optionally: verify that Kong routes were deleted for these modules via Kong management UI.Re-create discovery information: execute HTTP
POST
on<mgr-applications>/modules/discovery
with a modules discovery information (can be the same as inGET
step).
Verification
In Kong management UI, go to Gateway Services section, find some modules for which discovery information was just re-created, and check their routes - the expression section for route should NOT contain x_okapi_tenant
header part. E.g. go to module details, open routes tab, open any route and check the expression field: