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

Add Inclusion documentation for HTTPProxy #1573

Merged
merged 1 commit into from
Sep 26, 2019

Conversation

youngnick
Copy link
Member

@youngnick youngnick commented Sep 25, 2019

Fixes #1462

Add link to HTTPProxy documentation to upgrading.md, fixes #1476

Signed-off-by: Nick Young [email protected]

Copy link
Contributor

@davecheney davecheney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this. Just a bunch of nit picking comments but I think this is good to go on the next round.

docs/httpproxy.md Outdated Show resolved Hide resolved
docs/httpproxy.md Outdated Show resolved Hide resolved
docs/httpproxy.md Outdated Show resolved Hide resolved
docs/httpproxy.md Outdated Show resolved Hide resolved
docs/httpproxy.md Outdated Show resolved Hide resolved
docs/httpproxy.md Outdated Show resolved Hide resolved
docs/httpproxy.md Outdated Show resolved Hide resolved
docs/httpproxy.md Outdated Show resolved Hide resolved
docs/httpproxy.md Show resolved Hide resolved
docs/httpproxy.md Outdated Show resolved Hide resolved
@davecheney
Copy link
Contributor

davecheney commented Sep 25, 2019 via email

To resolve this Contour applies the following logic.

- `prefix:` conditions are concatenated together in the order they were applied from the root object. For example the conditions, `prefix: /api`, `prefix: /v1` becomes a single `prefix: /api/v1` conditions.
- Repeated identical `header:` conditions (the same `name`, match type, and `invert` values) are deduplicated to a single `header:` condition.
Copy link
Member

@stevesloka stevesloka Sep 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The invert language is abstracted away from users. They only see exact or notexact (or contains, notcontains) to set that flag.

Headers aren't merged either. We should discuss what should happen in this case. Should there be some sort of merge? Throw an error back to the user? Or just let them all stack ending up in a potential situation where requests won't match since the route is too specific.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I think they need to just be there, and we say that tautological conditions are an error.

Identical headers will end up deduplicated though, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change the invert part, yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, master the headers are all just smashed together, so if someone duplicates headers, the route must match all the defined headers to route properly.

There's an issue open (#1559), which I thought we would define an error if headers were duplicated. Thoughts on that approach? I'm not sure if use-cases exist where a route should match multiple headers of the same key with different values.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that they are deduplicated at the end when applied to Envoy - since setting a correctly-formed header is idempotent on a route (I assume). I think that contradictory headers should be an error, but exact matches (where the header name, value, and operator are the same)? That doesn't feel like an error to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, #1559 is probably the place for this discussion. Can we accept that this is the case for now, and get this one in?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to merge, just want to be careful that we don't explain functionality that doesn't exist or could change and we confuse folks right at the beginning.

HTTPProxies can include other HTTPProxy objects in the namespace by specifying the name of the object and its namespace in the top-level `includes` block.
Note that `includes` is a list, and so it must use the YAML list construct.

In this example, the HTTPProxy `delegation-root` has included the configuration for paths matching `/service2` from the HTTPPRoxy named `service2` in the same namespace as `delegation-root` (the `default` namespace).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still use "delegation" in speaking about "include", but should we try and stray away? I'm not sure if it's confusing to users who know IngressRoute or not. In a sense, we're performing the same operation but in a different way. This is just me thinking out loud.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should change the names, so that it's consistent, at least. Thanks.

I think that they're functionally the same, and it's probably okay in conversation, but I was trying to avoid being confusing in this reference documentation.

Note that `includes` is a list, and so it must use the YAML list construct.

In this example, the HTTPProxy `delegation-root` has included the configuration for paths matching `/service2` from the HTTPPRoxy named `service2` in the same namespace as `delegation-root` (the `default` namespace).
It's important to note that `service2` HTTPProxy has not defined a `virtualhost` property as it is NOT a root HTTPProxy.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/service2/www/g ??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, too much copypasta.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


#### Virtualhost aliases

To present the same set of routes under multiple dns entries, for example www.example.com and example.com, including a service with a `prefix` condition of `/` can be used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to do this so that you don't have to repeat the includes section twice is to have each root include to a single Proxy, then that one includes a child proxy. You end up with an additional Proxy object, but changes to the includes that are passed down are in a single place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your example is 100% correct, again just me typing out loud.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay to be a bit more verbose in this, since it's a reference guide.

Fixes projectcontour#1462

Update upgrading.md with HTTProxy docs, fixes projectcontour#1476

Signed-off-by: Nick Young <[email protected]>
Copy link
Contributor

@davecheney davecheney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you. I'll merge this now.

@davecheney davecheney merged commit f27bc5b into projectcontour:master Sep 26, 2019
@youngnick youngnick deleted the 1462-inclusion-docs branch April 27, 2020 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrading guide needs to be updated for 0.15 -> 1.0.0-beta1 docs: Update docs for httploadbalancer
3 participants