shreemaan-abhishek opened a new pull request, #2893:
URL: https://github.com/apache/apisix-ingress-controller/pull/2893
<!-- Please answer these questions before submitting a pull request -->
### Type of change:
- [x] Bugfix
### What this PR does / why we need it:
`fillHTTPRoutePolicies` decoded each `HTTPRoutePolicy` `spec.vars` item into
`[]StringOrSlice`. When an item failed to decode (for example
`{"remote_addr":"10.0.0.0/8"}` instead of `["remote_addr","==","10.0.0.1"]`),
the error was logged, the item was skipped, and the rest were still applied.
`vars` are AND-ed match conditions, so the published route matched more traffic
than the policy declared. The CRD accepts any JSON in `vars`, and the status
update was a `todo`, so nothing reported the problem.
This PR:
- Adds `ParseHTTPRoutePolicyVars`, which fails on the first malformed item.
`fillHTTPRoutePolicies` returns that error, and both callers (HTTPRoute and
Ingress translation) propagate it. A route with a malformed policy var is never
published with a partial set of conditions: an existing route keeps its last
good state and a new one is not programmed. For a match condition, that is the
most restrictive outcome.
- Sets `Accepted=False` with reason `Invalid` and the decode error on the
policy's ancestor status, for policies attached to both HTTPRoutes and
Ingresses. The invalid policy stays in the translate context so translation
still fails.
- Writes status updaters in the Ingress reconciler when `Provider.Update`
fails. It used to return first, so the policy condition would never be written.
Well-formed `vars` translate exactly as before.
### Pre-submission checklist:
- [x] Did you explain what problem does this PR solve? Or what new features
have been added?
- [x] Have you added corresponding test cases?
- [ ] Have you modified the corresponding document?
- [x] Is this PR backward compatible? **If it is not backward compatible,
please discuss on the [mailing
list](https://github.com/apache/apisix-ingress-controller#community) first**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]