-
Notifications
You must be signed in to change notification settings - Fork 529
Fixes TLS Mode Defaulting #518
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
Conversation
Thanks! This LGTM other than all the boilerplate year changes. That should be resolved once #519 is in. |
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.
LGTM. This will need a rebase once #519 is merged.
/hold Just to make sure this doesn't get merged before #519. |
@danehans Can you rebase to resolve the conflicts? |
@danehans Thanks for making this PR! After a rebase this LGTM. One small nit - I think this is a user-facing change since we're adding a default value. |
@robscott I updated the PR description to include user-facing changes. |
apis/v1alpha1/gateway_types.go
Outdated
Mode TLSModeType `json:"mode,omitempty"` | ||
|
||
// CertificateRef is the reference to Kubernetes object that | ||
// contain a TLS certificate and private key. | ||
// This certificate MUST be used for TLS handshakes for the domain | ||
// this GatewayTLSConfig is associated with. | ||
// | ||
// This field is required when mode is set to "Terminate" and optional | ||
// otherwise. |
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 was about lgtm this when I recalled why this was not the case earlier:
We wanted the user to explicitly set the condition to Terminate
and make them supply the Certificate in that case.
In this case, if this default kicks in, and a CertificateRef is absent, then how do we handle this case?
We could add validation in the webhook for this case.
Do we still want this to default though?
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.
That's a very good point - thanks for catching this! I think that approach makes sense, maybe instead of setting a default here we should clarify that both a CertificateRef and mode must be set as part of TLS config?
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 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.
Because Passthrough
is the rare case. It only makes sense with TCPRoute and TLSRoute (sni sniffing).
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 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.
The default of Terminate
makes sense here. What should be the error condition that should be set when CertificateRef is not supplied?
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.
Just to make sure I'm understanding this correctly, this default will not come into play unless someone specifies TLS config. It will essentially allow a shortcut where most users would only need to specify CertificateRef here. Does that sound right? If so, I think this is a very reasonable default.
@hbagdi That's a great question. I think our existing InvalidCertificateRef
condition would mostly apply here, even if the initial intent was slightly different.
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.
Just to make sure I'm understanding this correctly, this default will not come into play unless someone specifies TLS config. It will essentially allow a shortcut where most users would only need to specify CertificateRef here. Does that sound right?
That's correct. I pulled the patch down and tested it myself.
We actually missed specifying mode
even in our example: https://github.com/kubernetes-sigs/service-apis/blob/27c4d2dcd3c70a65a1d512fc7a21d2ca4403d218/examples/tls-basic.yaml#L23-L29
@hbagdi That's a great question. I think our existing InvalidCertificateRef condition would mostly apply here, even if the initial intent was slightly different.
Sounds fair. If the overhead is not too much, I'd advocate for a new AbsentCertificateRef or a generic AbsentRef condition.
LGTM. |
/approve |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bowei, danehans, hbagdi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Properly sets the "Terminate" default for
gateway.spec.tls.mode
.Which issue(s) this PR fixes:
Fixes #517
Does this PR introduce a user-facing change?:
Yes, sets the default TLS mode to "Terminate".