Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Changed the ui redirect path from a constant to a flag #56074

wants to merge 1 commit into from

Conversation

konryd
Copy link
Contributor

@konryd konryd commented Nov 20, 2017

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:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 20, 2017
@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Nov 20, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: konryd
We suggest the following additional approvers: deads2k, jszczepkowski

Assign the PR to them by writing /assign @deads2k @jszczepkowski in a comment when ready.

No associated issue. Update pull-request body to add a reference to an issue, or get approval with /approve no-issue

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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@konryd
Copy link
Contributor Author

konryd commented Nov 20, 2017

/assign @mwielgus @sttts

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 20, 2017
@@ -71,6 +71,8 @@ type ServerRunOptions struct {

MasterCount int
EndpointReconcilerType string

UIRedirectUrl string
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DestinationURL

Copy link
Member

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.

Copy link
Contributor Author

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to the given path

Copy link
Contributor Author

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 {
Copy link
Member

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.

Copy link
Contributor Author

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}
Copy link
Member

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?

Copy link
Contributor Author

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.

@lavalamp
Copy link
Member

It's a bit late but I'm inclined to take this, since hard coding this path is kinda dumb anyway.

@liggitt
Copy link
Member

liggitt commented Nov 20, 2017

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 /ui to become an API?

@@ -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.")
Copy link
Member

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 {
Copy link
Member

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?

Copy link
Member

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

Copy link
Contributor Author

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.

@bryk
Copy link
Contributor

bryk commented Nov 20, 2017

@liggitt

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 /ui to become an API?

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.

@liggitt
Copy link
Member

liggitt commented Nov 20, 2017

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 /ui? Is it required to exist? Is it required to redirect to kube-dashboard, or any UI?

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.

@konryd
Copy link
Contributor Author

konryd commented Nov 20, 2017

@liggitt

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
Copy link
Member

liggitt commented Nov 20, 2017

Should /ui get deprecated, a redirect to the replacement would be a way to introduce users to the change in a non-disruptive manner.

/ui is based on assumptions that do not hold for many API servers (see description of #53766). Rather than trying to re-introduce it at the cost of re-entangling the apiserver with a UI layer, I'd prefer to remove the incorrect coupling and allow UI's to deploy on top of the API.

@bryk
Copy link
Contributor

bryk commented Nov 20, 2017

@liggitt
I believe the contract for /ui is "it will open Kubernetes UI", though it was never formalized. I'd love to get rid of it, but there is plenty of references to /ui all over internet and even books like "Kubernetes: Up and Running".

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.

@bryk
Copy link
Contributor

bryk commented Nov 20, 2017

@kubernetes/dashboard-maintainers

@bryk
Copy link
Contributor

bryk commented Nov 20, 2017

@liggitt what do you believe would be needed to remove /ui endpoint? In terms of work items.

@liggitt
Copy link
Member

liggitt commented Nov 20, 2017

I think it'd be good to remove /ui endpoint long term

I agree. Let's not add flags, config, and encourage new use of something we think should be removed.

@liggitt what do you believe would be needed to remove /ui endpoint? In terms of work items.

  1. Announce deprecation
  2. Merge Remove /ui/ redirect #53766 after deprecation period

@k8s-ci-robot
Copy link
Contributor

@konryd: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-bazel-test a753d55 link /test pull-kubernetes-bazel-test
pull-kubernetes-e2e-gce a753d55 link /test pull-kubernetes-e2e-gce

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.

@konryd
Copy link
Contributor Author

konryd commented Nov 20, 2017

@liggitt @bryk @lavalamp

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.

@liggitt
Copy link
Member

liggitt commented Nov 20, 2017

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.

@lavalamp
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants