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

fix: detect filter chain support from API response #101

Merged
merged 1 commit into from
Jun 11, 2024
Merged

Conversation

flrgh
Copy link
Contributor

@flrgh flrgh commented Jun 6, 2024

This updates the business logic that is used to decide if (wasm) filter chains are supported by Kong. Instead of relying on the caller to set dump.Config.IsFilterChainsSupported, we check the error response code from GET /filter-chains and decide how to proceed from there.


See also: Kong/deck#987 specifically: Kong/deck#987 (comment)

KAG-4005

This updates the business logic that is used to decide if (wasm) filter
chains are supported by Kong. Instead of relying on the caller to set
`dump.Config.IsFilterChainsSupported`, we check the error response code
from `GET /filter-chains` and decide how to proceed from there.
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.

Project coverage is 41.16%. Comparing base (1e34a0b) to head (2d56d43).
Report is 2 commits behind head on main.

Files Patch % Lines
pkg/dump/dump.go 0.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #101      +/-   ##
==========================================
- Coverage   41.18%   41.16%   -0.02%     
==========================================
  Files          74       74              
  Lines       10802    10807       +5     
==========================================
  Hits         4449     4449              
- Misses       5891     5896       +5     
  Partials      462      462              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

return nil
})
} else {
group.Go(func() error {
state.FilterChains = make([]*kong.FilterChain, 0)
Copy link
Member

Choose a reason for hiding this comment

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

We don't really need to set this here and allocate the slice, right?

Line 271 will do I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right--we don't strictly need to allocate here. I thought it better to have the "set a default value" code at the top rather than hiding it 3 levels deep in the "we got an error, but it's okay" branch, but I have no objections to moving it.

@flrgh flrgh merged commit 2947f60 into main Jun 11, 2024
42 checks passed
@flrgh flrgh deleted the wasm-detection branch June 11, 2024 18:43
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.

4 participants