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

HTTPProxy include validation recently became too tight #5014

Closed
ecordell opened this issue Jan 27, 2023 · 8 comments
Closed

HTTPProxy include validation recently became too tight #5014

ecordell opened this issue Jan 27, 2023 · 8 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@ecordell
Copy link
Contributor

ecordell commented Jan 27, 2023

What steps did you take and what happened:
Prior to #4931, this worked:

apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: frontdoor
  namespace: example
spec:
  includes:
  - name: serviceA
    namespace: example
  - name: serviceB
    namespace: example
  virtualhost:
    fqdn: frontdoor.example.com
---
apiVersion: projectcontour.io/v1
kind: HTTPProxy
  name: serviceA
  namespace: example
spec:
  routes:
  - conditions:
    - prefix: /graphql
    services:
    - name: serviceA
      port: 5000
---
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: serviceB
  namespace: example
spec:
  routes:
  - conditions:
    - prefix: ""
    services:
    - name: serviceB
      port: 3000

But after the recent change, the top-level HTTPProxy now reports:

  conditions:
  - errors:
    - message: duplicate conditions defined on an include
      reason: DuplicateMatchConditions
      status: "True"
      type: IncludeError
    lastTransitionTime: "2023-01-26T12:09:47Z"
    message: At least one error present, see Errors for details
    observedGeneration: 1
    reason: ErrorPresent
    status: "False"
    type: Valid

Technically, the includes do have equal match conditions (nothing) - but they resolve to different fully resolved paths once the delegated HTTPProxy's paths is considered.

What did you expect to happen:

I expected this to be a valid config - from previous versions of contour, I know that this configuration used to create the envoy configuration that I expected (both services were routed properly). It seems like it reduces the value of the includes feature if I have to replicate the paths on the top-level object.

Environment:

  • Contour version: v1.24.0-rc.1
@ecordell ecordell added kind/bug Categorizes issue or PR as related to a bug. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor. labels Jan 27, 2023
@github-actions
Copy link

Hey @ecordell! Thanks for opening your first issue. We appreciate your contribution and welcome you to our community! We are glad to have you here and to have your input on Contour. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

@sunjayBhatia
Copy link
Member

hm, I would argue the previous behavior was not intended and the logic for checking duplicate includes was incorrect so that HTTPProxy should never have been valid

but given this has been around for a long time, people may be relying on it, and we don't want to suddenly break users with currently working config, we can think about how we might rework this change

@ecordell
Copy link
Contributor Author

Would it make more sense to validate the "merged" conditions for each route, rather than the conditions on the includes?

i.e. in this case it would verify: / and /graphql (and pass because they're different paths)

@sunjayBhatia
Copy link
Member

that may work, was looking at detecting the duplicate includes/routes on only the leaf Routes, however @skriss brought up a good point while we were chatting that the UX for how to report duplicates is now much more complicated for owners of child proxies:

if there is a duplicate match condition through the include tree + routes, where does the status go to report this to the user?

If there isn't actually an include error on the parent, does it really make sense to put it there? how would the owner of the child route get to know the error is there?

if it goes on the leaf HTTPProxy, the owner of that included resource may not know the layout of the include tree and not be able to fix the issue

with the existing change, any conflicts are headed off at the root which makes it easier

@sunjayBhatia
Copy link
Member

sunjayBhatia commented Jan 27, 2023

current plan is to go with a bit of a stop-gap solution, see here: #5017

the next contour release after 1.24 should have more correct validation in general, we will submit a design for that so the community can review

@sunjayBhatia
Copy link
Member

@ecordell take a look at the latest main image once it is pushed, to see if it works for your uses, which we think are possibly a common one (includes w/o any conditions)

@github-actions
Copy link

github-actions bot commented Apr 1, 2023

The Contour project currently lacks enough contributors to adequately respond to all Issues.

This bot triages Issues according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the Issue is closed

You can:

  • Mark this Issue as fresh by commenting
  • Close this Issue
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 1, 2023
@github-actions
Copy link

github-actions bot commented May 1, 2023

The Contour project currently lacks enough contributors to adequately respond to all Issues.

This bot triages Issues according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the Issue is closed

You can:

  • Mark this Issue as fresh by commenting
  • Close this Issue
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

2 participants