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: Per service configuration to ignore certain headers #1806

Merged
merged 11 commits into from Oct 1, 2021

Conversation

CarsonCook
Copy link
Contributor

@CarsonCook CarsonCook commented Sep 28, 2021

Description

This PR adds the ability to add apiml.headersToIgnore in service custom metadata to select which headers will be stripped from requests that go through the Gateway to that service.

Linked to #1797

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
  • 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

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

Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Carson Cook <carson.cook@ibm.com>
@CarsonCook
Copy link
Contributor Author

Code smell is due to code duplication, the duplication is boiler plate ZuulFilter method overrides.

Signed-off-by: Carson Cook <carson.cook@ibm.com>
Copy link
Contributor

@jandadav jandadav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change on the filter, I would still want to resolve the integration test.

Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Carson Cook <carson.cook@ibm.com>
@CarsonCook CarsonCook force-pushed the apiml/GH1797/perservice_ignore_headers branch from 1934bfe to bdb6ecf Compare September 30, 2021 16:01
@sonarcloud
Copy link

sonarcloud bot commented Sep 30, 2021

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

90.9% 90.9% Coverage
3.0% 3.0% Duplication

Copy link
Contributor

@jandadav jandadav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the changes!

@jandadav jandadav merged commit b258732 into master Oct 1, 2021
@delete-merged-branch delete-merged-branch bot deleted the apiml/GH1797/perservice_ignore_headers branch October 1, 2021 07:59
CarsonCook added a commit that referenced this pull request Oct 27, 2021
* PoC for per service ignore headers

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Dry code getting service instance from uri

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Improve filter name

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Add RouteUtil unit tests

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Add per service ignore header filter unit tests

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Add integration test for ignoring headers

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Fix proxyrequesthelper instantiation

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Use zuul context to get service instance

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Move integration test to functional test

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Fix mocking http client

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Remove formatting changes

Signed-off-by: Carson Cook <carson.cook@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants