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

feat: Spring cloud gateway routing #3031

Merged
merged 32 commits into from
Aug 22, 2023
Merged

feat: Spring cloud gateway routing #3031

merged 32 commits into from
Aug 22, 2023

Conversation

pj892031
Copy link
Contributor

@pj892031 pj892031 commented Aug 14, 2023

Description

This PR implements routing in SCGW. The original implementation contained two ways how to route and it was required to set up this type of routing by APIML_SERVICE_GATEWAY_PROXY_ENABLED.

The new implementation support both and they are as default enabled.

The preferred routing is by header (if the header is set, this type of routing is used). Differences against the original routing by header:

  • the header required localhost and serviceId. It was changed to use serviceId or apimlId (used by Gateway)
  • the routing string could contain multiple steps separated by /
  • the header is changed during throughput (ie. 'APIML1/APIML2' > 'APIML2' > nothing). It allows routing with infinity levels of APIML

The second way is routing by basePath. There is just one change - it allows to use APIML ID.

New APIML metadata:

  • apiml.service.externalUrl
    • if this URL is defined SCGW skips the load balancer and resends request to this hostname and scheme
    • for Gateways it will be set by an external URL such as a DVIPA address
  • apiml.service.apimlId
    • this value identifies an instance of APIML
    • it should be used to route between multiple APIML instances (see multitenancy and multiple GW with the same serviceId)

It also contains:

  • refactor of authentication schema filters (authentication is available for both type of routing)
  • fix of common method removeFirstAndLastOccurrence

Linked to #2884
Part of the #2651

Type of change

Please delete options that are not relevant.

  • (fix) Bug fix (non-breaking change which fixes an issue)
  • (feat) New feature (non-breaking change which adds functionality)
  • (docs) Change in a documentation
  • (refactor) Refactor the code
  • (chore) Chore, repository cleanup, updates the dependencies.
  • (BREAKING CHANGE or !) Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas. In JS I did provide JSDoc
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The java tests in the area I was working on leverage @nested annotations
  • Any dependent changes have been merged and published in downstream modules

For more details about how should the code look like read the Contributing guideline

Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
pj892031 and others added 3 commits August 14, 2023 16:04
Signed-off-by: Elena Kubantseva <elena.kubantseva@broadcom.com>
Signed-off-by: Elena Kubantseva <elena.kubantseva@broadcom.com>
@achmelo achmelo changed the title (feat) Spring cloud gateway routing feat: Spring cloud gateway routing Aug 15, 2023
pj892031 and others added 15 commits August 15, 2023 17:36
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
…epend on the bug

Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
@pj892031 pj892031 marked this pull request as ready for review August 17, 2023 12:18
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
@sonarcloud
Copy link

sonarcloud bot commented Aug 22, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

97.2% 97.2% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@pj892031 pj892031 merged commit a1dd492 into v2.x.x Aug 22, 2023
33 checks passed
@delete-merged-branch delete-merged-branch bot deleted the reboot/scgwRouting branch August 22, 2023 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants