-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Changed the ui redirect path from a constant to a flag #56074
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: konryd Assign the PR to them by writing No associated issue. Update pull-request body to add a reference to an issue, or get approval with The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@@ -71,6 +71,8 @@ type ServerRunOptions struct { | |||
|
|||
MasterCount int | |||
EndpointReconcilerType string | |||
|
|||
UIRedirectUrl 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.
s/Url/URL/g
pkg/routes/ui.go
Outdated
// UIRedirect redirects /ui to the kube-ui proxy path. | ||
type UIRedirect struct{} | ||
type UIRedirect struct { | ||
DashboardPath 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.
DestinationURL
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.
Actually destinationURL
since it doesn't need to be public.
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/routes/ui.go
Outdated
@@ -22,14 +22,18 @@ import ( | |||
"k8s.io/apiserver/pkg/server/mux" | |||
) | |||
|
|||
const dashboardPath = "/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy" | |||
|
|||
// UIRedirect redirects /ui to the kube-ui proxy path. |
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.
to the given path
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/routes/ui.go
Outdated
DashboardPath string | ||
} | ||
|
||
func NewUIRedirect(dashboardPath string) UIRedirect { |
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.
Change the name here, too (it's not necessarily just a path). Add a godoc comment.
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/routes/ui.go
Outdated
} | ||
|
||
func NewUIRedirect(dashboardPath string) UIRedirect { | ||
return UIRedirect{DashboardPath: dashboardPath} |
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.
are all destinations equally valid?
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.
Not sure I understand the question. I've manually validated an http redirect to work.
It's a bit late but I'm inclined to take this, since hard coding this path is kinda dumb anyway. |
I'd rather see the apiserver become less entangled with UIs, not more ("why does my API server have a UI-related flag?"). Do we really want |
@@ -188,6 +191,9 @@ func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) { | |||
"A port range to reserve for services with NodePort visibility. "+ | |||
"Example: '30000-32767'. Inclusive at both ends of the range.") | |||
|
|||
fs.StringVar(&s.UIRedirectUrl, "ui-redirect-url", s.UIRedirectUrl, ""+ | |||
"URL of the application serving the UI for the cluster.") |
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.
Suggestion: provide a way to disable this. Setting it to the empty string?
@@ -302,7 +303,7 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) | |||
} | |||
|
|||
if c.ExtraConfig.EnableUISupport { |
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 EnableUISupport currently exposed in a flag?
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.
no, and access to /ui
is not allowed as part of standard policy, either
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.
Didn't see it anywhere.
I think it it already an API. There's a lot of blog posts, documentation, links out there that link to /ui. That's why we're having this PR. |
What is the contract of Making the apiserver aware of a UI running against the apiserver seems like a mistake we should be moving away from, not doubling down on. |
Should /ui get deprecated, a redirect to the replacement would be a way to introduce users to the change in a non-disruptive manner. |
|
@liggitt Just removing /ui would break flows of beginner users who follow some tutorial. I think it'd be good to remove /ui endpoint long term. I don't believe we can do this for 1.9, though. |
@kubernetes/dashboard-maintainers |
@liggitt what do you believe would be needed to remove /ui endpoint? In terms of work items. |
I agree. Let's not add flags, config, and encourage new use of something we think should be removed.
|
@konryd: The following tests 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. |
It looks like there's a general agreement on the need to deprecate the /ui endpoint, but we seem to disagree on the exact way of handling it. Unless preceded with community outreach, cutting off the /ui will get perceived as abrupt, no matter how long the feature is deprecated. Setting this to a new location will let us move away from it while not surprising users. |
Adding config/flags and encouraging new use of it is the opposite of deprecating, and will make it harder to move away from. |
I think I prefer #53766 to this PR. @liggitt can you make sure a note about deprecation ends up in the 1.9 release notes, and put some comments in the code about when it is safe to remove this feature? (Points that swayed me: /ui isn't safe for https, and a flag is the wrong way to configure something that all apiservers have to be in sync on.) @konryd I am sorry I don't have a work around for you. You can investigate installing something in the place of the service which does a redirection. I can't promise it will work, though. It is too late in the release process to provide a real solution. |
What this PR does / why we need it: It changes the UI redirect path into a environment-settable flag. This makes it possible to serve the /ui requests for cases when the Kubernetes dashboard is replaced by custom app.
Release note: