Add -W and -E flags to allow users to control error severity#2049
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2049 +/- ##
==========================================
- Coverage 32.85% 32.57% -0.29%
==========================================
Files 77 77
Lines 7068 7132 +64
==========================================
+ Hits 2322 2323 +1
- Misses 4550 4613 +63
Partials 196 196 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c5f48d8 to
be31a54
Compare
| err := sync( | ||
| context.Background(), | ||
| "testdata/render/005-diagnostics/rla-consumer-groups.yaml", | ||
| "-W", "rla-consumer-groups-deprecated", |
There was a problem hiding this comment.
I don't think this particular code should be allowed as a warning. Do customers require this deprecated way of defining configs?
We have had a lot of consumer-group reconciliation bugs and I don't want a deprecated flow that used to error out since at least 2 years to be allowed now. I don't know what other can of worms would it open up if folks start using it.
There was a problem hiding this comment.
There's one customer that still uses this heavily. It used to be a 2.8 gate, and we moved it to be 3.4.
By adding this option we provide a "you can make this a warning, but you're on your own" option. The alternative is that we bump the gate to 3.10 (and 3.14 etc as they upgrade) and have to officially support it
| ) | ||
| require.Error(t, err) | ||
| require.ErrorContains(t, err, "Valid diagnostic codes") | ||
| require.ErrorContains(t, err, "route-regex-path-format") |
There was a problem hiding this comment.
@mheap How would folks know about these valid codes?
I don't see them in the help output.
There was a problem hiding this comment.
The intention is that we only tell people who hit issues. We should continue to be opinionated (e.g. OIDC salt is an error). Support will be enabled on which codes are available to respond.
The "hidden" way to get a list is to pass an invalid value:
❯ go run main.go file render -W foobar
Error: invalid value for -W/--errors-as-warnings: unknown diagnostic code: foobar. Valid diagnostic codes: [oidc-missing-required-config rla-consumer-groups-deprecated route-regex-path-format]
exit status 1
daccbe8 to
3e931f4
Compare
Uses emitter from Kong/go-database-reconciler#466
When we added the OIDC validation we received feedback that some customers want to treat this as a warning and not an error. We do not want to make this a warning only, and so I've added the ability for users to choose which validation are an error and which are a warning using the
-Wand-EflagsNOTE: This is using a branch from go-database-reconciler. Once the GDR PR is merged, I'll update this PR to point at a release