FS: Remove multiTenantFrontend flag (#110776)

* FS: Move multiTenantFrontend evaluation to OpenFeature

* comment

* actually, just remove the toggle

* fix k8s prefs test using toggle

* replace frontend flag usage

* codeowners

* move isFrontendService just into core

* put back comment
This commit is contained in:
Josh Hunt 2025-09-09 10:39:29 +01:00 committed by GitHub
parent 7651b7b77e
commit 4e05bb36f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 30 additions and 31 deletions

1
.github/CODEOWNERS vendored
View File

@ -870,6 +870,7 @@ playwright.storybook.config.ts @grafana/grafana-frontend-platform
/public/app/core/utils/accessControl.ts @grafana/identity-access-team /public/app/core/utils/accessControl.ts @grafana/identity-access-team
/public/app/core/utils/applyStateChanges.ts @grafana/dashboards-squad /public/app/core/utils/applyStateChanges.ts @grafana/dashboards-squad
/public/app/core/utils/arrayMove.ts @grafana/grafana-frontend-platform /public/app/core/utils/arrayMove.ts @grafana/grafana-frontend-platform
/public/app/core/utils/isFrontendService.ts @grafana/grafana-frontend-platform
/public/app/core/utils/auth.ts @grafana/identity-access-team /public/app/core/utils/auth.ts @grafana/identity-access-team
/public/app/core/utils/browser* @grafana/grafana-frontend-platform /public/app/core/utils/browser* @grafana/grafana-frontend-platform
/public/app/core/utils/colors.ts @grafana/grafana-frontend-platform /public/app/core/utils/colors.ts @grafana/grafana-frontend-platform

View File

@ -35,7 +35,7 @@ services:
GF_DEFAULT_APP_MODE: development GF_DEFAULT_APP_MODE: development
GF_PANELS_ENABLE_ALPHA: true GF_PANELS_ENABLE_ALPHA: true
GF_SERVER_CDN_URL: http://localhost:3010 GF_SERVER_CDN_URL: http://localhost:3010
GF_FEATURE_TOGGLES_ENABLE: multiTenantFrontend enableNativeHTTPHistogram GF_FEATURE_TOGGLES_ENABLE: enableNativeHTTPHistogram
GF_DATABASE_URL: postgres://grafana:grafana@postgres:5432/grafana GF_DATABASE_URL: postgres://grafana:grafana@postgres:5432/grafana
GF_SERVER_ROUTER_LOGGING: true GF_SERVER_ROUTER_LOGGING: true
GF_LOG_LEVEL: info GF_LOG_LEVEL: info

View File

@ -195,6 +195,9 @@ export interface BootData {
light: string; light: string;
dark: string; dark: string;
}; };
/** @deprecated Internal Grafana usage only. This property will be removed at any time. */
_femt?: boolean;
} }
/** /**

View File

@ -965,10 +965,6 @@ export interface FeatureToggles {
*/ */
pluginsAutoUpdate?: boolean; pluginsAutoUpdate?: boolean;
/** /**
* Register MT frontend
*/
multiTenantFrontend?: boolean;
/**
* Enables the alerting list view v2 preview toggle * Enables the alerting list view v2 preview toggle
*/ */
alertingListViewV2PreviewToggle?: boolean; alertingListViewV2PreviewToggle?: boolean;

View File

@ -84,10 +84,8 @@ func (hs *HTTPServer) registerRoutes() {
r.Get("/login", hs.LoginView) r.Get("/login", hs.LoginView)
r.Get("/invite/:code", hs.Index) r.Get("/invite/:code", hs.Index)
if hs.Features.IsEnabledGlobally(featuremgmt.FlagMultiTenantFrontend) { // Temporary MT-frontend config endpoint
// Temporarily expose the full bootdata via API r.Get("/bootdata", reqNoAuth, hs.GetBootdata)
r.Get("/bootdata", reqNoAuth, hs.GetBootdata)
}
// authed views // authed views
r.Get("/", reqSignedIn, hs.Index) r.Get("/", reqSignedIn, hs.Index)

View File

@ -32,9 +32,12 @@ import (
// NOTE: this should not be added to the public API docs, and is useful for a transition // NOTE: this should not be added to the public API docs, and is useful for a transition
// towards a fully static index.html -- this will likely be replaced with multiple calls // towards a fully static index.html -- this will likely be replaced with multiple calls
func (hs *HTTPServer) GetBootdata(c *contextmodel.ReqContext) { func (hs *HTTPServer) GetBootdata(c *contextmodel.ReqContext) {
c, span := hs.injectSpan(c, "api.GetBootdata")
defer span.End()
data, err := hs.setIndexViewData(c) data, err := hs.setIndexViewData(c)
if err != nil { if err != nil {
c.Handle(hs.Cfg, http.StatusInternalServerError, "Failed to get settings", err) c.JsonApiErr(http.StatusInternalServerError, "Failed to get settings", err)
return return
} }
c.JSON(http.StatusOK, data) c.JSON(http.StatusOK, data)

View File

@ -1664,13 +1664,6 @@ var (
FrontendOnly: false, FrontendOnly: false,
Owner: grafanaPluginsPlatformSquad, Owner: grafanaPluginsPlatformSquad,
}, },
{
Name: "multiTenantFrontend",
Description: "Register MT frontend",
Stage: FeatureStageExperimental,
FrontendOnly: false,
Owner: grafanaFrontendPlatformSquad,
},
{ {
Name: "alertingListViewV2PreviewToggle", Name: "alertingListViewV2PreviewToggle",
Description: "Enables the alerting list view v2 preview toggle", Description: "Enables the alerting list view v2 preview toggle",

View File

@ -216,7 +216,6 @@ grafanaAssistantInProfilesDrilldown,GA,@grafana/observability-traces-and-profili
postgresDSUsePGX,experimental,@grafana/oss-big-tent,false,false,false postgresDSUsePGX,experimental,@grafana/oss-big-tent,false,false,false
tempoAlerting,experimental,@grafana/observability-traces-and-profiling,false,false,true tempoAlerting,experimental,@grafana/observability-traces-and-profiling,false,false,true
pluginsAutoUpdate,experimental,@grafana/plugins-platform-backend,false,false,false pluginsAutoUpdate,experimental,@grafana/plugins-platform-backend,false,false,false
multiTenantFrontend,experimental,@grafana/grafana-frontend-platform,false,false,false
alertingListViewV2PreviewToggle,privatePreview,@grafana/alerting-squad,false,false,true alertingListViewV2PreviewToggle,privatePreview,@grafana/alerting-squad,false,false,true
alertRuleUseFiredAtForStartsAt,experimental,@grafana/alerting-squad,false,false,false alertRuleUseFiredAtForStartsAt,experimental,@grafana/alerting-squad,false,false,false
alertingBulkActionsInUI,GA,@grafana/alerting-squad,false,false,true alertingBulkActionsInUI,GA,@grafana/alerting-squad,false,false,true

1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
216 postgresDSUsePGX experimental @grafana/oss-big-tent false false false
217 tempoAlerting experimental @grafana/observability-traces-and-profiling false false true
218 pluginsAutoUpdate experimental @grafana/plugins-platform-backend false false false
multiTenantFrontend experimental @grafana/grafana-frontend-platform false false false
219 alertingListViewV2PreviewToggle privatePreview @grafana/alerting-squad false false true
220 alertRuleUseFiredAtForStartsAt experimental @grafana/alerting-squad false false false
221 alertingBulkActionsInUI GA @grafana/alerting-squad false false true

View File

@ -875,10 +875,6 @@ const (
// Enables auto-updating of users installed plugins // Enables auto-updating of users installed plugins
FlagPluginsAutoUpdate = "pluginsAutoUpdate" FlagPluginsAutoUpdate = "pluginsAutoUpdate"
// FlagMultiTenantFrontend
// Register MT frontend
FlagMultiTenantFrontend = "multiTenantFrontend"
// FlagAlertingListViewV2PreviewToggle // FlagAlertingListViewV2PreviewToggle
// Enables the alerting list view v2 preview toggle // Enables the alerting list view v2 preview toggle
FlagAlertingListViewV2PreviewToggle = "alertingListViewV2PreviewToggle" FlagAlertingListViewV2PreviewToggle = "alertingListViewV2PreviewToggle"

View File

@ -2229,7 +2229,8 @@
"metadata": { "metadata": {
"name": "multiTenantFrontend", "name": "multiTenantFrontend",
"resourceVersion": "1753448760331", "resourceVersion": "1753448760331",
"creationTimestamp": "2025-04-25T09:24:25Z" "creationTimestamp": "2025-04-25T09:24:25Z",
"deletionTimestamp": "2025-09-08T17:06:39Z"
}, },
"spec": { "spec": {
"description": "Register MT frontend", "description": "Register MT frontend",

View File

@ -252,7 +252,7 @@
const rawBootData = await loadBootData(); const rawBootData = await loadBootData();
window.grafanaBootData = { window.grafanaBootData = {
_femt: true, _femt: true, // isFrontendService() needs this
...rawBootData, ...rawBootData,
} }

View File

@ -30,7 +30,6 @@ func TestIntegrationPreferences(t *testing.T) {
DisableAnonymous: true, DisableAnonymous: true,
EnableFeatureToggles: []string{ EnableFeatureToggles: []string{
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs,
featuremgmt.FlagMultiTenantFrontend, // So we can compare to boot-data preferences
}, },
}) })

View File

@ -22,9 +22,9 @@ describe('SignInLink', () => {
expect(link).toHaveAttribute('target', '_self'); expect(link).toHaveAttribute('target', '_self');
}); });
describe('with multiTenantFrontend toggle enabled', () => { describe('with frontend-service enabled', () => {
beforeAll(() => { beforeAll(() => {
config.featureToggles.multiTenantFrontend = true; config.bootData._femt = true;
}); });
it('should render a link to the login page', () => { it('should render a link to the login page', () => {

View File

@ -4,12 +4,12 @@ import { useLocation } from 'react-router-dom-v5-compat';
import { GrafanaTheme2, locationUtil, textUtil } from '@grafana/data'; import { GrafanaTheme2, locationUtil, textUtil } from '@grafana/data';
import { Trans } from '@grafana/i18n'; import { Trans } from '@grafana/i18n';
import { config } from '@grafana/runtime';
import { useStyles2 } from '@grafana/ui'; import { useStyles2 } from '@grafana/ui';
import { contextSrv } from 'app/core/services/context_srv'; import { contextSrv } from 'app/core/services/context_srv';
import { isFrontendService } from 'app/core/utils/isFrontendService';
export function SignInLink() { export function SignInLink() {
const femt = Boolean(config.featureToggles.multiTenantFrontend); const femt = isFrontendService();
const location = useLocation(); const location = useLocation();
const styles = useStyles2(getStyles); const styles = useStyles2(getStyles);
let loginUrl = femt let loginUrl = femt

View File

@ -3,6 +3,7 @@ import { Navigate, useLocation } from 'react-router-dom-v5-compat';
import { config, locationSearchToObject, navigationLogger, reportPageview } from '@grafana/runtime'; import { config, locationSearchToObject, navigationLogger, reportPageview } from '@grafana/runtime';
import { ErrorBoundary } from '@grafana/ui'; import { ErrorBoundary } from '@grafana/ui';
import { isFrontendService } from 'app/core/utils/isFrontendService';
import { useGrafana } from '../context/GrafanaContext'; import { useGrafana } from '../context/GrafanaContext';
import { contextSrv } from '../services/context_srv'; import { contextSrv } from '../services/context_srv';
@ -64,7 +65,7 @@ export function GrafanaRouteWrapper({ route }: Pick<Props, 'route'>) {
const location = useLocation(); const location = useLocation();
// Perform login check in the frontend now // Perform login check in the frontend now
if (config.featureToggles.multiTenantFrontend) { if (isFrontendService()) {
const routeRequiresSignin = !route.allowAnonymous && !config.anonymousEnabled; const routeRequiresSignin = !route.allowAnonymous && !config.anonymousEnabled;
if (routeRequiresSignin && !contextSrv.isSignedIn) { if (routeRequiresSignin && !contextSrv.isSignedIn) {
contextSrv.setRedirectToUrl(); contextSrv.setRedirectToUrl();

View File

@ -23,7 +23,7 @@ export interface RouteDescriptor {
/** /**
* Allow the route to be access by anonymous users. * Allow the route to be access by anonymous users.
* Currently only used if the `multiTenantFrontend` feature toggle is enabled. * Currently only used when using the frontend-service.
*/ */
allowAnonymous?: boolean; allowAnonymous?: boolean;
} }

View File

@ -0,0 +1,9 @@
import { config } from '@grafana/runtime';
/**
* Returns true if the current instance is using the frontend-service.
* @internal
*/
export function isFrontendService() {
return config.bootData._femt;
}