-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
ingress: Add force-https annotation support #30616
Conversation
d23f7b3
to
9499019
Compare
/test |
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.
Small non-blocking suggestion for docs
221e34b
to
c968dba
Compare
/test |
c968dba
to
3ea4f63
Compare
/test |
3ea4f63
to
055edd6
Compare
/test |
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.
Nice - thanks Nick! 🎉 Some small comments and improvements inline.
7c00575
to
a8eb9f2
Compare
/test |
a8eb9f2
to
2276144
Compare
/test |
1 similar comment
/test |
2276144
to
704f872
Compare
/test |
240386e
to
31756af
Compare
This change adds support for the new `ingress.cilium.io/force-https` annotation. This annotation changes generated model.Listeners such that, if a TLS Listener is present, any config for that secure listener is copied to an insecure listener, with redirects to the secure listener for routing instead of direct routing. The annotation itself can be set to `enabled`, `disabled`, or any truthy or false-y value (as understood by Go's `strconv.ParseBool()` function). The annotation _overrides_ the exsiting "enforce-https" config, which does the same thing. That is, if both `ingress.cilium.io/force-https` and `enforce-https` are set, the annotation's value will override the value of `enforce-https`. When the annotation is unset, `enforce-https` produces similar functionality. Tests for all cases have been added. Implementation details: - `model.Listener` now has a `ForceHTTPtoHTTPSRedirect` field that controls if the redirect behavior will be used. - The value of `enforceHTTPS` is no longer passed into Translators. Ingress ingestion now handles folding the possible values of `enforceHTTPS` into the `model.Listener`, so the Translators now don't need to know. Signed-off-by: Nick Young <[email protected]>
31756af
to
2dbe133
Compare
/test |
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 - thanks Nick!
Currently, the config property `enforce-ingress-https` doesn't have any effect as its value isn't propagated to the ingresscontroller reconciler. Hence, Ingress HTTPS is never enforced globally (only via annotation). This commit fixes this by passing the config value to the reconciler. Fixes: cilium#30616 Signed-off-by: Marco Hofstetter <[email protected]>
@@ -38,6 +38,7 @@ type ingressReconciler struct { | |||
defaultLoadbalancerMode string | |||
defaultSecretNamespace string | |||
defaultSecretName string | |||
enforcedHTTPS bool |
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.
@youngnick looks enforcedHTTPS
isn't handled in newIngressReconciler
- hence it's always false
. We should pass the corresponding config value from the cell.
I opened #30804
Currently, the config property `enforce-ingress-https` doesn't have any effect as its value isn't propagated to the ingresscontroller reconciler. Hence, Ingress HTTPS is never enforced globally (only via annotation). This commit fixes this by passing the config value to the reconciler. Fixes: #30616 Signed-off-by: Marco Hofstetter <[email protected]>
Currently, the config property `enforce-ingress-https` doesn't have any effect as its value isn't propagated to the ingresscontroller reconciler. Hence, Ingress HTTPS is never enforced globally (only via annotation). This commit fixes this by passing the config value to the reconciler. Fixes: cilium#30616 Signed-off-by: Marco Hofstetter <[email protected]>
This change adds support for the new
ingress.cilium.io/force-https
annotation. This annotation changes generated model.Listeners such that, if a TLS Listener is present, any config for that secure listener is copied to an insecure listener, with redirects to the secure listener for routing instead of direct routing.The annotation itself can be set to
enabled
,disabled
, or any truthy or false-y value (as understood by Go'sstrconv.ParseBool()
function).The annotation overrides the exsiting "enforce-https" config, which does the same thing.
That is, if both
ingress.cilium.io/force-https
andenforce-https
are set, the annotation's value will override the value ofenforce-https
.When the annotation is unset,
enforce-https
produces similar functionality.Tests for all cases have been added.
Implementation details:
model.Listener
now has aForceHTTPtoHTTPSRedirect
field that controls if the redirect behavior will be used.enforceHTTPS
is no longer passed into Translators. Ingress ingestion now handles folding the possible values ofenforceHTTPS
into themodel.Listener
, so the Translators now don't need to know.Updates: #22887