-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: TLS listeners supported #112
Conversation
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
aef7eb8
to
e6752fc
Compare
// ListenereReasonInvalidTLSMode must be used with the Accepted condition | ||
// to express that the listener has an invalid TLS mode. | ||
// HTTPS can only be configured with mode Terminate, while TLS can only be | ||
// be configured with mode Passthrough. | ||
ListenereReasonInvalidTLSMode k8sutils.ConditionReason = "InvalidTLSMode" |
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.
// ListenereReasonInvalidTLSMode must be used with the Accepted condition | |
// to express that the listener has an invalid TLS mode. | |
// HTTPS can only be configured with mode Terminate, while TLS can only be | |
// be configured with mode Passthrough. | |
ListenereReasonInvalidTLSMode k8sutils.ConditionReason = "InvalidTLSMode" | |
// ListenerReasonInvalidTLSMode must be used with the Accepted condition | |
// to express that the listener has an invalid TLS mode. | |
// HTTPS can only be configured with mode Terminate, while TLS can only be | |
// be configured with mode Passthrough. | |
ListenerReasonInvalidTLSMode k8sutils.ConditionReason = "InvalidTLSMode" |
We might add a reference link to https://gateway-api.sigs.k8s.io/guides/tls/#clientserver-and-tls which contains the table with allowed modes for particular route types.
{ | ||
Name: "", | ||
Value: consts.ControlPlaneAdmissionWebhookEnvVarValue, | ||
}, |
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 believe we don't need this right?
if listener.Protocol != gatewayv1.HTTPProtocolType && | ||
listener.Protocol != gatewayv1.HTTPSProtocolType && | ||
listener.Protocol != gatewayv1.TLSProtocolType { |
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 supportedRoutesByProtocol()
like so:
_, ok := supportedRoutesByProtocol()[listener.Protocol]
and then check !ok
? This way we can avoid forgetting to update this when we add support for other protocols. WDYT?
// Only TLS terminate mode supported with HTTPS Listeners. | ||
if listener.Protocol == gatewayv1.HTTPSProtocolType && *listener.TLS.Mode != gatewayv1.TLSModeTerminate { | ||
acceptedCondition.Status = metav1.ConditionFalse | ||
acceptedCondition.Reason = string(ListenereReasonInvalidTLSMode) | ||
acceptedCondition.Message = "Only Terminate mode is supported with HTTPS listeners" | ||
} | ||
|
||
// Only TLS passthrough mode supported with TLS Listeners. | ||
if listener.Protocol == gatewayv1.TLSProtocolType && *listener.TLS.Mode != gatewayv1.TLSModePassthrough { | ||
acceptedCondition.Status = metav1.ConditionFalse | ||
acceptedCondition.Reason = string(ListenereReasonInvalidTLSMode) | ||
acceptedCondition.Message = "Only Passthrough mode is supported with TLS listeners" | ||
} |
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.
WDYT about using a switch
on the protocol here and then nesting the particular conditions for those protocols inside the case
s?
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 add one more sample with just the TLSRoute
and a Gateway
with TLS
listener?
Closing as not planned for now |
What this PR does / why we need it:
Support for TLS Listeners and TLSRoutes.
Which issue this PR fixes
Fixes #64
Special notes for your reviewer:
PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect significant changes