-
Notifications
You must be signed in to change notification settings - Fork 303
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
Implement support for HTTPS Redirects #1206
Implement support for HTTPS Redirects #1206
Conversation
Hi @spencerhance. Thanks for your PR. I'm waiting for a kubernetes 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. |
/ok-to-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, would like one more pair of eyes on it 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.
How about only supporting GC for the v2 naming scheme.
One more thing, there is one corner case: If someone enabled the HTTP redirect and disable later. Will the RedirectURLMap get trimmed? From the code, I do not think so, right?
Maybe handle this as part of the ensureRedirectUrlMap code?
pkg/utils/namer/frontendnamer.go
Outdated
@@ -88,6 +90,11 @@ func (ln *V1IngressFrontendNamer) UrlMap() string { | |||
return ln.namer.UrlMap(ln.lbName) | |||
} | |||
|
|||
// UrlMap implements IngressFrontendNamer. | |||
func (ln *V1IngressFrontendNamer) RedirectUrlMap() string { | |||
return ln.namer.RedirectUrlMap(ln.lbName) |
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 strongly recommend NOT to support this feature in V1 Namer.
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.
Return an error event. Asking user to recreate ingress and it will come with new naming scheme.
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.
Done
pkg/utils/namer/interfaces.go
Outdated
@@ -25,6 +25,8 @@ type IngressFrontendNamer interface { | |||
TargetProxy(protocol NamerProtocol) string | |||
// UrlMap returns the name of the URL Map. | |||
UrlMap() string | |||
// RedirectUrlMap returns the name of the URL Map. | |||
RedirectUrlMap() string |
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.
// RedirectUrlMap returns the name of the URL Map and if the namer supports naming redirectUrlMap
RedirectUrlMap() (string, 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.
Done
58914c0
to
a2f591d
Compare
Good point, I added in code to delete it when disabled |
a2f591d
to
ad3c93e
Compare
return err | ||
} | ||
|
||
currentMap, err := composite.GetUrlMap(l.cloud, key, l.Versions().UrlMap) |
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 worth avoiding this GET call every time an irrelevant ingress was synced.
One idea is to check if the the ingress status annotation has the redirectUrlMap
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.
Done
return err | ||
} | ||
|
||
if expectedMap == nil { |
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.
add a comment here to say "do not expect to have a RedirectUrlMap"
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.
Done
pkg/loadbalancers/url_maps.go
Outdated
return err | ||
} | ||
} | ||
} else { |
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.
probably no need for the else block
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.
Done
Adds support for using HTTPS Redirects via a Redirects Config in FrontendConfig Also includes a new status annotation for the additional UrlMap that needs to be synced
ad3c93e
to
da73204
Compare
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: freehan, spencerhance 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 |
Good to know this has been merged finally! I'm new to this, when is the expected timeline for this to be available in GKE? And is there any documentation that comes along with it? |
Yes, would really love to use this, when will it be available in GKE? |
Is this going to be live at some point in this century ? |
Hi folks, please follow the discussion at #1075 We are doing everything we can to launch this ASAP |
tr := translator.NewTranslator(isL7ILB, l.namer) | ||
// Get UrlMap Name, could be the url map or the redirect url map | ||
// TODO(shance): move to translator | ||
var umName string |
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.
Why didn't this code written as follow with less branches?
umName := l.um.Name
if flags.F.EnableFrontendConfig {
// TODO(shance): check for empty name?
if l.redirectUm != nil && l.runtimeInfo.FrontendConfig.Spec.RedirectToHttps != nil && l.runtimeInfo.FrontendConfig.Spec.RedirectToHttps.Enabled {
umName = l.redirectUm.Name
}
}
Adds support for using HTTPS Redirects with L7 ELB via a Redirects Config in FrontendConfig
Also includes a new status annotation for the additional UrlMap that needs to be synced
e2e tests will be added in a follow up