-
Notifications
You must be signed in to change notification settings - Fork 384
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
validate all xds resources before returning the translation result #5148
base: main
Are you sure you want to change the base?
Conversation
befa1a4
to
4d53353
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5148 +/- ##
==========================================
+ Coverage 66.85% 66.88% +0.03%
==========================================
Files 210 209 -1
Lines 32979 32917 -62
==========================================
- Hits 22047 22018 -29
+ Misses 9592 9573 -19
+ Partials 1340 1326 -14 ☔ View full report in Codecov by Sentry. |
6eb31de
to
a03807e
Compare
@@ -131,6 +131,12 @@ func (t *Translator) Translate(xdsIR *ir.Xds) (*types.ResourceVersionTable, erro | |||
} | |||
} | |||
|
|||
// Validate all the xds resources in the table before returning | |||
// This is necessary to catch any misconfigurations that might have been missed during translation | |||
if err := tCtx.ValidateAll(); err != nil { |
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.
This is the key change, the rest are minor refactors around the proto validation.
@@ -82,10 +82,7 @@ func buildHCMBasicAuthFilter(basicAuth *ir.BasicAuth) (*hcmv3.HttpFilter, error) | |||
}, | |||
}, | |||
} | |||
if err = basicAuthProto.ValidateAll(); err != nil { |
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.
Validation in individual filer translators are not required anymore, as they'll be validated inside the proto.ToAnyWithValidation
function before converting to any
.
abd87f7
to
5faed17
Compare
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
should we CP to 1.3.0 ? |
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
This PR enforces validation for all generated xDS resources before sending them to the Envoy fleet.
Related to: #5147
Release Notes: No