Cfg: Adds experimental scope grafana.ini settings (#83174)

Signed-off-by: bergquist <carl.bergquist@gmail.com>
pull/83929/head
Carl Bergquist 1 year ago committed by GitHub
parent 7f970d4887
commit b3efb4217e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      packages/grafana-data/src/types/featureToggles.gen.ts
  2. 3
      pkg/api/dtos/frontend_settings.go
  3. 6
      pkg/api/frontendsettings.go
  4. 11
      pkg/services/featuremgmt/registry.go
  5. 1
      pkg/services/featuremgmt/toggles_gen.csv
  6. 4
      pkg/services/featuremgmt/toggles_gen.go
  7. 2024
      pkg/services/featuremgmt/toggles_gen.json
  8. 9
      pkg/setting/setting.go

@ -179,4 +179,5 @@ export interface FeatureToggles {
expressionParser?: boolean;
groupByVariable?: boolean;
alertingUpgradeDryrunOnStart?: boolean;
scopeFilters?: boolean;
}

@ -262,4 +262,7 @@ type FrontendSettingsDTO struct {
Whitelabeling *FrontendSettingsWhitelabelingDTO `json:"whitelabeling,omitempty"`
LocalFileSystemAvailable bool `json:"localFileSystemAvailable"`
// Experimental Scope settings
ListScopesEndpoint string `json:"listScopesEndpoint"`
ListDashboardScopesEndpoint string `json:"listDashboardScopesEndpoint"`
}

@ -356,6 +356,12 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
// Set the kubernetes namespace
frontendSettings.Namespace = hs.namespacer(c.SignedInUser.OrgID)
// experimental scope features
if hs.Features.IsEnabled(c.Req.Context(), featuremgmt.FlagScopeFilters) {
frontendSettings.ListScopesEndpoint = hs.Cfg.ScopesListScopesURL
frontendSettings.ListDashboardScopesEndpoint = hs.Cfg.ScopesListDashboardsURL
}
return frontendSettings, nil
}

@ -1197,6 +1197,17 @@ var (
RequiresRestart: true,
Expression: "true", // enabled by default
},
{
Name: "scopeFilters",
Description: "Enables the use of scope filters in Grafana",
FrontendOnly: false,
Stage: FeatureStageExperimental,
Owner: grafanaDashboardsSquad,
RequiresRestart: false,
AllowSelfServe: false,
HideFromDocs: true,
HideFromAdminPage: true,
},
}
)

@ -160,3 +160,4 @@ kubernetesAggregator,experimental,@grafana/grafana-app-platform-squad,false,true
expressionParser,experimental,@grafana/grafana-app-platform-squad,false,true,false
groupByVariable,experimental,@grafana/dashboards-squad,false,false,false
alertingUpgradeDryrunOnStart,GA,@grafana/alerting-squad,false,true,false
scopeFilters,experimental,@grafana/dashboards-squad,false,false,false

1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
160 expressionParser experimental @grafana/grafana-app-platform-squad false true false
161 groupByVariable experimental @grafana/dashboards-squad false false false
162 alertingUpgradeDryrunOnStart GA @grafana/alerting-squad false true false
163 scopeFilters experimental @grafana/dashboards-squad false false false

@ -650,4 +650,8 @@ const (
// FlagAlertingUpgradeDryrunOnStart
// When activated in legacy alerting mode, this initiates a dry-run of the Unified Alerting upgrade during each startup. It logs any issues detected without implementing any actual changes.
FlagAlertingUpgradeDryrunOnStart = "alertingUpgradeDryrunOnStart"
// FlagScopeFilters
// Enables the use of scope filters in Grafana
FlagScopeFilters = "scopeFilters"
)

File diff suppressed because it is too large Load Diff

@ -521,6 +521,10 @@ type Cfg struct {
// News Feed
NewsFeedEnabled bool
// Experimental scope settings
ScopesListScopesURL string
ScopesListDashboardsURL string
}
// AddChangePasswordLink returns if login form is disabled or not since
@ -1281,6 +1285,11 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error {
cfg.readFeatureManagementConfig()
cfg.readPublicDashboardsSettings()
// read experimental scopes settings.
scopesSection := iniFile.Section("scopes")
cfg.ScopesListScopesURL = scopesSection.Key("list_scopes_endpoint").MustString("")
cfg.ScopesListDashboardsURL = scopesSection.Key("list_dashboards_endpoint").MustString("")
return nil
}

Loading…
Cancel
Save