-
Notifications
You must be signed in to change notification settings - Fork 36
Create NewTrafficPolicyFromJson deserializer checking for unknown keys and implement it in translating ingresses #718
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #718 +/- ##
==========================================
+ Coverage 49.13% 49.14% +0.01%
==========================================
Files 96 96
Lines 10604 10616 +12
==========================================
+ Hits 5210 5217 +7
- Misses 5037 5038 +1
- Partials 357 361 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jonstacks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good. Just a few changes around error messaging.
The place where this could break someone is if they had a traffic policy like:
bad_key: "I'm ignored today"
on_http_request:
(fully valid policy here)
Today we ignore the bad_key completely. This would now throw an error for the bad key. I think this is expected behavior, but something we'll want to call out in the release notes.
Did the changes requested in the last commit of this PR
|
I tested the changes in my local, but I was having issues with SSH to push my commit and it was a small change so I just did a commit via suggestions on here. |
| name: "invalid JSON should error", | ||
| input: `{invalid}`, | ||
| expectError: true, | ||
| errContains: "failed to unmarshal traffic policy: invalid character 'i' looking for beginning of object key string. raw traffic policy: map[]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we would expect the original traffic policy {invalid} to be printed so the user knows what wasn't able to be parsed. I think what you had before was close, it just needed to be cast as a string rather than a []byte
…s and implement it in translating ingresses
Co-authored-by: Jonathan Stacks <[email protected]>
Co-authored-by: Jonathan Stacks <[email protected]>
Co-authored-by: Jonathan Stacks <[email protected]>
99ef197 to
e7c146e
Compare
#K8SOP-147
What
it looks like we don't handle traffic policy with an inbound phase appropriately. Instead we just discard all of it, leading to no user supplied policy being merged with our generated traffic policy.
This could just be an edge case that you only hit with the inbound key
How
Amp suggested that we create a new JSON deserializer that checks the valid traffic policy keys (on_http_request, on_http_response, and on_tcp_connect) and have a bunch of error handling for edge cases such as this.
Breaking Changes
¯\(ツ)/¯