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

NET-5398: Update UI server to include if v2 is enabled #20353

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

WenInCode
Copy link
Contributor

@WenInCode WenInCode commented Jan 25, 2024

Description

For NET-5398 we need to not render the rest of the ui app if v2 catalog is enabled and show a message as to why it's disabled and link out to help resources. Right now this would require another network request on app boot and we would have to wait until that resolves before rendering the rest of the app.

I saw that experiments is a part of the runtime config so I figured we could add a V2CatalogEnabled property to the config that we pass to the UI app. With this, we can immediately check if V2 is enabled and render the help page, or immediately proceed with normal app operations if it's not enabled.

Enabled:
Screenshot 2024-01-25 at 2 47 00 PM

Disabled:
Screenshot 2024-01-25 at 3 56 46 PM

Testing & Reproduction steps

I've tested this by building the ui and the consul and then running it with and without the resources-api experiment enabled. Reference the linked issues below for more instructions.

Links

NET-5398
Running Consul with v2 enabled
Original slack question about how to determine v2 is enabled

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

@WenInCode WenInCode added the theme/ui Anything related to the UI label Jan 25, 2024
@WenInCode WenInCode force-pushed the NET-5398/add-V2Enabled-to-config branch from c9330f7 to 85aac2b Compare January 25, 2024 22:07
@WenInCode WenInCode force-pushed the NET-5398/add-V2Enabled-to-config branch from 85aac2b to 05cd0a2 Compare January 25, 2024 22:22
@hc-github-team-consul-core
Copy link
Collaborator

This PR has diffs in agent/uiserver/dist. If the changes are intentional, add the label pr/update-ui-assets. Otherwise, revert changes to agent/uiserver/dist.

@WenInCode WenInCode force-pushed the NET-5398/add-V2Enabled-to-config branch from 05cd0a2 to ddb730c Compare January 25, 2024 22:46
@@ -31,6 +31,14 @@ func uiTemplateDataFromConfig(cfg *config.RuntimeConfig) (map[string]interface{}
uiCfg["metrics_provider_options"] = json.RawMessage(cfg.UIConfig.MetricsProviderOptionsJSON)
}

v2CatalogEnabled := false
for _, experiment := range cfg.Experiments {
if experiment == "resource-apis" {
Copy link
Contributor

Choose a reason for hiding this comment

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

v1/agent/self is an interesting endpoint 🤔 and the DebugConfig field seems to be completely undocumented on the consul apis page.

Does "enabled" here mean the DC has a V2 service registered or just that it has the permission to register one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is it's like a feature flag, not telling you that you actually have services registered. However, if you have this experiment enabled, requests to V1 catalog endpoints don't succeed.

@WenInCode WenInCode force-pushed the NET-5398/add-V2Enabled-to-config branch from 32a25b8 to 2b8feba Compare January 26, 2024 19:50
@WenInCode WenInCode merged commit 7e08d89 into main Jan 26, 2024
91 checks passed
@WenInCode WenInCode deleted the NET-5398/add-V2Enabled-to-config branch January 26, 2024 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/no-backport theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants