-
Notifications
You must be signed in to change notification settings - Fork 513
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
HTTPRoute: Add Reencrypt #81
HTTPRoute: Add Reencrypt #81
Conversation
Hi @Miciah. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Miciah The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
api/v1alpha1/httproute_types.go
Outdated
@@ -190,6 +195,19 @@ type HTTPRouteAction struct { | |||
Extension *core.TypedLocalObjectReference `json:"extension"` | |||
} | |||
|
|||
// HTTPReencrypt specifies parameters for re-encrypting the forwarded | |||
// connection. | |||
type HTTPReencrypt struct { |
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 type would be an appropriate place to add a field to configure a client certificate for mTLS in the future.
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.
AppProtocol field is being added to k8s 1.18 and there might be a conflict for that here.
I think having this makes sense to me but we should have an explicit protocols field here to define what is the protocol to use when communicating with the upstream service. It can be added in the future. Just leaving a note here, not requesting any changes or advocating against this field.
api/v1alpha1/tcproute_types.go
Outdated
type TCPRouteHost struct { | ||
// Hostname is a fully qualified domain name. This must be a registered | ||
// name as defined by RFC 3986. Note that IP addresses cannot be used. | ||
Hostname string `json:"hostname"` |
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.
There should be a destination for each host in this section, similar to HTTPRouteAction
in the HTTPRoute
resource. Am I missing something?
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.
Yes, we will need to add targets as well. I wanted to focus this PR on the pieces that would enable the three use-cases that I listed (edge-termination, re-encrypt, and pass-through TLS), but I can fill out the TCPRoute
target as part of this PR if that would make the idea clearer.
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.
I'd recommend to have at least a mock struct in place with a TODO.
api/v1alpha1/tcproute_types.go
Outdated
// TCPRouteSpec defines the desired state of the TCPRoute. | ||
type TCPRouteSpec struct { | ||
// Hosts is a list of Host definitions. | ||
Hosts []TCPRouteHost `json:"hosts,omitempty"` |
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.
I think it would be better to call this Rules
instead.
Also, s/TCPRouteHost/TCPRouteRule
.
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.
I wanted to keep the structure of TCPRoute
similar to the structure of HTTPRoute
where possible. Should we make the change you are suggesting to HTTPRoute
as well?
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.
HTTPRoute is up in the air right now because we are still working through the relationship of Gateway, HTTPRoute and host
.
THe current api is:
hosts:
- host: "foo.com"
destinations # will be in future
- host: "bar.com"
SNIP
hosts
seems not the best name here since it is not an array of hosts
but something more.
docs-src/concepts.md
Outdated
`TCPRoute` does not dictate that the TLS connection encapsulate a | ||
specific protocol. A common use-case for `TCPRoute` is to pass | ||
through connections to an HTTPS server, but in principle `TCPRoute` | ||
can be used to forward any protocol that is compatible with TLS. |
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.
There is another use-case that needs to be addressed with TCPRoute resource:
A user wants to route traffic based on TCP ports, meaning, don't even peek into the TCP stream. This is a subset of the use-case in #66.
We can merge this in and I can piggy back on top of these changes.
What I'm thinking is:
- Define a port in addition to
host
for matching - Make the
host
optional. If it is not present, then the proxy performs port based routing, if the host is present, then the proxy performs SNI based routing.
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.
In this use case, is it is one-to-one: one listener to one route? That could work. I am wary of implicit APIs, so maybe instead of empty host
it could be an explicit *
value, or something more explicit?
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.
@hbagdi WDYT about filing a separate user story for that use case?
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.
Opened up #96
api/v1alpha1/tcproute_types.go
Outdated
// TCPRouteHost is the configuration for a given host. | ||
type TCPRouteHost struct { | ||
// Hostname is a fully qualified domain name. This must be a registered | ||
// name as defined by RFC 3986. Note that IP addresses cannot be used. |
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.
Since Hostname
is sort of overloaded in multiple layers of the OSI model, can we be explicit here that host
in this case means the SNI
in the TLS
protocol?
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.
Yeah, we can do that. I think it would be clearest to define range of acceptable values (as the godoc I wrote attempts to do), and then explain how the value is intended to be used (namely, to match the TLS SNI). Does that seem reasonable?
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.
Sounds good to me. I'm not sure where it should be present, in godoc or somewhere else. At the moment, godoc seems like a good place.
/ok-to-test |
api/v1alpha1/httproute_types.go
Outdated
// Reencrypt specifies that the gateway controller should re-encrypt the | ||
// forwarded connection. | ||
// +optional | ||
Reencrypt *HTTPReencrypt `json:"reencrypt"` |
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.
Can we use the Service app-protocol instead of putting it here?
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.
@Miciah @bowei we need to make a decision on what persona is responsible for managing certificates. https://github.com/kubernetes-sigs/service-apis/pull/71/files#diff-e7d01144441bba257ce9bedd33a139c6R217 provides similar functionality but resides within Gateway
. Is a Cluster Operator responsible for listener certs and a Dev responsible for backend certs?
@Miciah if the Dev persona is responsible for managing backend certs, then this PR is the preferred approach.
api/v1alpha1/tcproute_types.go
Outdated
type TcpRouteSpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
// TCPRouteSpec defines the desired state of the TCPRoute. |
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.
Is this TCPRoute or TLSRoute?
TCP means plain TCP
TLSRoute seems to be more apt?
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.
I don't have a preference on naming but we want to support both of these use-cases, TCP and TLS routing using the same CRD.
My leaning is slightly more towards TCPRoute.
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.
Might be confusing for users, we will have to make sure it's unambiguous what happens, also can be kind of weird to mix TCP and TLS together (do users have this as a use case)? Also, TCP has no such thing as SNI, Host etc.
I'm guessing you are thinking of something like this?
gateway:
port 80, protocol TCP
port 443, protocol TLS
routes:
- myRoute
myRoute:
TCPRoute
"foo.com" => svc1
* => svc2
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.
Something more like:
TCP (port based routing):
- port: 4242 => svc1
- port: 2424 => svc2
This is the dumbest form of routing one can have essentially.
#96
TLS (SNI based routing):
- host/sni: foo.com => svc1
- host/sni: bar.com => svc2
This can optionally include port too. User story: I want TLS sessions for foo.com on port X to be routed to svc1 but foo.com on port Y should not be allowed.
docs-src/concepts.md
Outdated
|
||
#### `TCPRoute` | ||
|
||
TODO | ||
`TCPRoute` is a namespace-scoped resource defined by the application |
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.
See comment above (TCPRoute vs TLSRoute) naming
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.
Ah, right, sorry, it is TCPRoute
, but this paragraph suggests that it is necessarily TLS; I will update (and maybe try to incorporate the dedicated-port use-case described in #81 (comment)).
I filed a user story specifically for TCP forwarding #94. |
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.
General feedback ...
I think it would be better to address HTTPRoute and TCPRoute in separate PRs. In particular, because TCPRoute is just a placeholder right now, it seems like a more involved discussion,
For the "Reencrypt"; I'm not enamored of that terminology. TLS is a per-hop property and each hop can be configured independently, so re-encryption can be a misnomer if the front end wasn't encrypted in the first place.
@Miciah I agree that TCPRoute should be a separate PR.
@Miciah Instead of |
I wanted to address them in the same PR in order to present a comprehensive, minimally redundant solution to cover the three related but disjoint use-cases. If it makes review easier, I can refocus this PR on
Good point. We could rename the field to
Agreed, |
Latest push deletes changes to |
abf7d2a
to
1268bd1
Compare
Rebased. |
I'll hold off on submitting a PR for |
1268bd1
to
418fb37
Compare
Rebased. |
418fb37
to
176ab95
Compare
Rebased. |
176ab95
to
e6c37e6
Compare
xref: #52 |
* api/v1alpha1/httproute_types.go (HTTPRouteHost): Add TLS field. (HTTPRouteTLS): New type. Allow specifying a destination CA certificate. * docs-src/concepts.md: Stub out description of HTTPRoute. * api/v1alpha1/generated.pb.go: * api/v1alpha1/generated.proto: * api/v1alpha1/zz_generated.deepcopy.go: * config/crd/bases/networking.x.k8s.io_httproutes.yaml: * docs/concepts/index.html: * docs/search/search_index.json: Regenerate.
Rebase and regenerate deepcopy and protobuf. |
e6c37e6
to
c8769b4
Compare
@Miciah: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@Miciah: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/close |
@robscott: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Added frontend and middleware manifest files from Online Boutique v0.3.5
api/v1alpha1/httproute_types.go
(HTTPRouteHost
): AddTLS
field.(
HTTPRouteTLS
): New type. Allow specifying a destination CA certificate.api/v1alpha1/generated.pb.go
:api/v1alpha1/generated.proto
:api/v1alpha1/zz_generated.deepcopy.go
:config/crd/bases/networking.x.k8s.io_httproutes.yaml
:docs/concepts/index.html
:docs/search/search_index.json
: Regenerate.Here is a draft of an approach for accommodating the re-encrypt use-case #124.