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

Apply webrouteprefix on debug endpoints #2524

Closed
wants to merge 6 commits into from

Conversation

ranjithkumar007
Copy link
Contributor

@ranjithkumar007 ranjithkumar007 commented Apr 25, 2020

Fixes #2486
Signed-off-by: ranjithkumar007 ranjith.dakshana2015@gmail.com

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Verification

Verified locally by checking the URLs with and without webrouteprefix.

@ranjithkumar007
Copy link
Contributor Author

ranjithkumar007 commented Apr 25, 2020

Also, there seems some issue with js/CSS not being loaded properly when webrouteprefix is provided. Attached screenshots below

Without any webrouteprefix:
Screenshot from 2020-04-25 16-51-55

With webrouteprefix
Screenshot from 2020-04-25 16-51-52

Should I open an issue for this?

@yeya24
Copy link
Contributor

yeya24 commented Apr 25, 2020

The current solution for this is when web route prefix is provided, then web external prefix should also be provided, to make the static resources in the valid path.

@@ -335,7 +335,8 @@ func registerBucketWeb(m map[string]setupFunc, root *kingpin.CmdClause, name str
prober.NewInstrumentation(comp, logger, extprom.WrapRegistererWithPrefix("thanos_", reg)),
)

srv := httpserver.New(logger, reg, comp, httpProbe,
srv := httpserver.New(logger, reg, comp, "/",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want webRoutePrefix for all components, instead of just using / here? cc @GiedriusS @bwplotka

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure if it is required for all components.
@bwplotka any inputs here?

@ranjithkumar007
Copy link
Contributor Author

ranjithkumar007 commented Apr 25, 2020

The current solution for this is when web route prefix is provided, then web external prefix should also be provided, to make the static resources in the valid path.

Got it. So, I think the above screenshots shouldn't be an issue.

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks, looks good, but I think we can simplify by using path.Join to concatenate the URL paths.

@@ -247,7 +247,8 @@ func runCompact(
prober.NewInstrumentation(component, logger, extprom.WrapRegistererWithPrefix("thanos_", reg)),
)

srv := httpserver.New(logger, reg, component, httpProbe,
srv := httpserver.New(logger, reg, component, "/",
Copy link
Member

Choose a reason for hiding this comment

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

Why not we route as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked existing compacter flags in which there was no web.route-prefix. I was not sure whether I should add web.route-prefix flag to all components.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I add web.route-prefix to all components?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ping

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May be we can do it in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be nice to have --web.route-prefix in other components as well, but let's leave it for a separate PR.

pkg/server/http/http.go Outdated Show resolved Hide resolved
@ranjithkumar007
Copy link
Contributor Author

failing e2e unrelated to PR

@squat
Copy link
Member

squat commented Jun 27, 2020

Rerunning :)

@yeya24
Copy link
Contributor

yeya24 commented Jun 27, 2020

@ranjithkumar007 E2E still failing.

Would you mind fixing this e2e test?

##[error]    TestQueryRoutePrefix: query_test.go:184: query_test.go:184:
        
         unexpected error: the service querier-1 is not ready; err: got no expected status code: 404, expected: 200
      

I think the problem is here https://github.com/thanos-io/thanos/blob/master/test/e2e/e2ethanos/services.go#L170, you should add the web route prefix to readiness probe path as well.

@ranjithkumar007
Copy link
Contributor Author

@ranjithkumar007 E2E still failing.

Would you mind fixing this e2e test?

##[error]    TestQueryRoutePrefix: query_test.go:184: query_test.go:184:
        
         unexpected error: the service querier-1 is not ready; err: got no expected status code: 404, expected: 200
      

I think the problem is here https://github.com/thanos-io/thanos/blob/master/test/e2e/e2ethanos/services.go#L170, you should add the web route prefix to readiness probe path as well.

Thanks @yeya24 .
Got it.. I will fix that.

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Great! Looks good and CI passed.
@kakkoyun Would you mind giving some 👀 on this pr? I am not sure if this pr affects something in the kube-thanos repo.

Signed-off-by: ranjithkumar007 <ranjith.dakshana2015@gmail.com>
Signed-off-by: Ranjith Kumar <ranjith.dakshana2015@gmail.com>
Signed-off-by: Ranjith Kumar <ranjith.dakshana2015@gmail.com>
Signed-off-by: Ranjith Kumar <ranjith.dakshana2015@gmail.com>
Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

These changes look good regarding kube-thanos. We just need to change a mixin we have in queried specs https://github.com/thanos-io/kube-thanos/blob/3b7d80d643dec546f1bfa8dc18b38460d0d57f53/jsonnet/kube-thanos/kube-thanos-query.libsonnet#L142-L164
We can do this after these changes are merged.

Signed-off-by: Ranjith Kumar <ranjith.dakshana2015@gmail.com>
Copy link
Member

@onprem onprem left a comment

Choose a reason for hiding this comment

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

Looks great. LGTM 🎉

@ranjithkumar007
Copy link
Contributor Author

Anything left here?

@squat
Copy link
Member

squat commented Aug 31, 2020

@ranjithkumar007 sorry we let this get so stale. Can you please rebase?

CC @prmsrswt for review considering web route prefix changes

@onprem
Copy link
Member

onprem commented Aug 31, 2020

There are some changes in route and external prefix handling in master branch which are not present in this PR so I'll test again after a rebase, but I think these changes are good to go 💯.

@yeya24
Copy link
Contributor

yeya24 commented Sep 1, 2020

@ranjithkumar007 Hello. Sorry for the delay, but this pr is pretty close now. Can you please rebase master and fix the conflict? Thank you!

@onprem
Copy link
Member

onprem commented Sep 2, 2020

The new component Query Frontend also uses the httpserver.New function which was modified in this PR. @ranjithkumar007 can you update the code to use web.route-prefix there as well? Thanks.

@yeya24
Copy link
Contributor

yeya24 commented Sep 2, 2020

@prmsrswt Thanks for this! It is fine for Query frontend now. I need to investigate whether route prefix breaks anything in Query frontend first. If it doesn't bring any risk, then I will add it in another pr.

@ranjithkumar007 Can you please fix the CI failures?

@onprem
Copy link
Member

onprem commented Sep 2, 2020

The CI failures are because Query Frontend now has to use the modified HTTP server, which expects web route prefix as an argument. As @yeya24 said, we can pass an empty string for now in the case of Query Frontend and then investigate it further if it makes sense.

@yeya24
Copy link
Contributor

yeya24 commented Sep 2, 2020

The CI failures are because Query Frontend now has to use the modified HTTP server, which expects web route prefix as an argument. As @yeya24 said, we can pass an empty string for now in the case of Query Frontend and then investigate it further if it makes sense.

Oh yes, I missed that the function signature is changed 👍

@kakkoyun
Copy link
Member

kakkoyun commented Sep 8, 2020

@ranjithkumar007 Friendly ping. Any update on this?

@kakkoyun
Copy link
Member

@ranjithkumar007 Any update? We can take this over if you're busy.

@yeya24 @prmsrswt What do you think? Shall we take this one over?

@ranjithkumar007
Copy link
Contributor Author

@ranjithkumar007 Any update? We can take this over if you're busy.

Sorry, I wasn't getting time outside of work. Please feel free to take over.

@stale
Copy link

stale bot commented Jan 6, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Jan 6, 2021
@stale stale bot closed this Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Web route prefix is not applied on debug endpoints.
6 participants