-
Notifications
You must be signed in to change notification settings - Fork 2k
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
config: UI configuration block with Vault/Consul links #11555
Conversation
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 shouldn't be approving this. But, great job!
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. A few comments and suggestions, but none are blockers.
s.mux.Handle("/ui/", http.StripPrefix("/ui/", s.handleUI(http.FileServer(&UIAssetWrapper{FileSystem: assetFS()})))) | ||
s.logger.Debug("UI is enabled") | ||
} else { | ||
// Write the stubHTML | ||
s.mux.HandleFunc("/ui/", func(w http.ResponseWriter, r *http.Request) { | ||
w.Write([]byte(stubHTML)) |
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.
stubHTML
is only set when building without the ui
build tag. This results in the /ui
endpoint to return a 200
and a empty page.
Looking at Vault and Consul, they each do different things. Vault returns 404
response code and a an error message:
Consul returns a 200
and generic content body:
Personally I would say Vault's seems to be the most correct approach, but no strong feelings. I think we could move this handler registration to the else
clause below and add a generic 404
body content in the handleRootFallthrough
handler.
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.
Yeah I'd intentionally not touched the existing behavior for the fallthrough, but a 404 does sound a lot nicer. Will do.
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, having tried it just now I don't think that's very user friendly. If you go to http://localhost:4646
you end up getting a redirect to http://localhost:4646/ui
with just the browser's 404 page. Having some stub content there and filling it out so that it does something more similar to Consul seems nicer.
(If the UI is disabled in the build, you get an explanation of that from https://github.com/hashicorp/nomad/blob/main/command/agent/stub_asset.go)
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.
Fixed in 8006bd6
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!
Add `ui` block to agent configuration to enable/disable the web UI and provide the web UI with links to Vault/Consul.
Co-authored-by: Luiz Aoqui <[email protected]>
6ac6d56
to
8006bd6
Compare
I realized just as I pressed the squash button that the branch name
|
The `TestHTTPServer_Limits_Error` test never starts the agent so it had an incomplete configuration, which caused panics in the test. Fix the configuration. The PR #11555 had a branch name like `f-ui-*` which caused CI to skip the unit tests over the HTTP handler setup, so this wasn't caught in PR review.
The `TestHTTPServer_Limits_Error` test never starts the agent so it had an incomplete configuration, which caused panics in the test. Fix the configuration. The PR #11555 had a branch name like `f-ui-*` which caused CI to skip the unit tests over the HTTP handler setup, so this wasn't caught in PR review.
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
For #5860
Add
ui
block to agent configuration to enable/disable the web UI andprovide the web UI with links to Vault/Consul.
This PR should probably wait pending on the RFC I've circulated earlier today. But this is what it looks like with this configuration block:
It shows up like the following in the API: