Grafana controllers: Add generic disable setting (#112250)
This commit is contained in:
@@ -248,7 +248,7 @@ func RegisterAPIService(
|
||||
}
|
||||
|
||||
builder := NewAPIBuilder(
|
||||
cfg.ProvisioningDisableControllers,
|
||||
cfg.DisableControllers,
|
||||
repoFactory,
|
||||
features,
|
||||
client,
|
||||
|
||||
@@ -134,8 +134,9 @@ type Cfg struct {
|
||||
HomePath string
|
||||
ProvisioningPath string
|
||||
PermittedProvisioningPaths []string
|
||||
// Grafana API Server
|
||||
DisableControllers bool
|
||||
// Provisioning config
|
||||
ProvisioningDisableControllers bool
|
||||
ProvisioningAllowedTargets []string
|
||||
ProvisioningAllowImageRendering bool
|
||||
ProvisioningMinSyncInterval time.Duration
|
||||
@@ -2120,7 +2121,12 @@ func (cfg *Cfg) readProvisioningSettings(iniFile *ini.File) error {
|
||||
}
|
||||
}
|
||||
|
||||
cfg.ProvisioningDisableControllers = iniFile.Section("provisioning").Key("disable_controllers").MustBool(false)
|
||||
cfg.DisableControllers = iniFile.Section("provisioning").Key("disable_controllers").MustBool(false)
|
||||
// if disable_controllers is not set, check if grafana-apiserver.disable_controllers is set
|
||||
// TODO: consolidate to just [grafana-apiserver]disable_controllers
|
||||
if !cfg.DisableControllers {
|
||||
cfg.DisableControllers = iniFile.Section("grafana-apiserver").Key("disable_controllers").MustBool(false)
|
||||
}
|
||||
cfg.ProvisioningAllowedTargets = iniFile.Section("provisioning").Key("allowed_targets").Strings("|")
|
||||
if len(cfg.ProvisioningAllowedTargets) == 0 {
|
||||
cfg.ProvisioningAllowedTargets = []string{"instance", "folder"}
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestIntegrationProvisioning_JobConflict(t *testing.T) {
|
||||
|
||||
// disable the controllers so the jobs don't get auto-processed
|
||||
helper := runGrafana(t, func(opts *testinfra.GrafanaOpts) {
|
||||
opts.DisableProvisioningControllers = true
|
||||
opts.DisableControllers = true
|
||||
})
|
||||
ctx := context.Background()
|
||||
|
||||
|
||||
@@ -545,10 +545,10 @@ func CreateGrafDir(t *testing.T, opts GrafanaOpts) (string, string) {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
if opts.DisableProvisioningControllers {
|
||||
provisioningSection, err := getOrCreateSection("provisioning")
|
||||
if opts.DisableControllers {
|
||||
apiserverSection, err := getOrCreateSection("grafana-apiserver")
|
||||
require.NoError(t, err)
|
||||
_, err = provisioningSection.NewKey("disable_controllers", "true")
|
||||
_, err = apiserverSection.NewKey("disable_controllers", "true")
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -622,7 +622,7 @@ type GrafanaOpts struct {
|
||||
EnableRecordingRules bool
|
||||
EnableSCIM bool
|
||||
APIServerRuntimeConfig string
|
||||
DisableProvisioningControllers bool
|
||||
DisableControllers bool
|
||||
|
||||
// When "unified-grpc" is selected it will also start the grpc server
|
||||
APIServerStorageType options.StorageType
|
||||
|
||||
Reference in New Issue
Block a user