UniStore: Add config to enable periodic DualWriter DataSyncer (#93555)
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
This commit is contained in:
@@ -67,6 +67,7 @@ kubernetesPlaylists = true
|
||||
|
||||
[unified_storage.playlists.playlist.grafana.app]
|
||||
dualWriterMode = 2
|
||||
dualWriterPeriodicDataSyncJobEnabled = true
|
||||
```
|
||||
|
||||
This will create a development kubeconfig and start a parallel ssl listener. It can be registered by
|
||||
|
||||
@@ -170,9 +170,13 @@ func InstallAPIs(
|
||||
// Get the option from custom.ini/command line
|
||||
// when missing this will default to mode zero (legacy only)
|
||||
var mode = grafanarest.DualWriterMode(0)
|
||||
|
||||
var dualWriterPeriodicDataSyncJobEnabled bool
|
||||
|
||||
resourceConfig, resourceExists := storageOpts.UnifiedStorageConfig[key]
|
||||
if resourceExists {
|
||||
mode = resourceConfig.DualWriterMode
|
||||
dualWriterPeriodicDataSyncJobEnabled = resourceConfig.DualWriterPeriodicDataSyncJobEnabled
|
||||
}
|
||||
|
||||
// Force using storage only -- regardless of internal synchronization state
|
||||
@@ -198,7 +202,7 @@ func InstallAPIs(
|
||||
default:
|
||||
}
|
||||
|
||||
if storageOpts.DualWriterDataSyncJobEnabled[key] {
|
||||
if dualWriterPeriodicDataSyncJobEnabled {
|
||||
grafanarest.StartPeriodicDataSyncer(ctx, currentMode, legacy, storage, key, reg, serverLock, requestInfo)
|
||||
}
|
||||
|
||||
|
||||
@@ -60,11 +60,6 @@ func applyGrafanaConfig(cfg *setting.Cfg, features featuremgmt.FeatureToggles, o
|
||||
unifiedStorageCfg := cfg.UnifiedStorage
|
||||
o.StorageOptions.UnifiedStorageConfig = unifiedStorageCfg
|
||||
|
||||
o.StorageOptions.DualWriterDataSyncJobEnabled = map[string]bool{
|
||||
// TODO: This will be enabled later, when we get a dedicated config section for unified_storage
|
||||
// playlist.RESOURCE + "." + playlist.GROUP: true,
|
||||
}
|
||||
|
||||
o.ExtraOptions.DevMode = features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerEnsureKubectlAccess)
|
||||
o.ExtraOptions.ExternalAddress = host
|
||||
o.ExtraOptions.APIURL = apiURL
|
||||
|
||||
@@ -32,9 +32,6 @@ type StorageOptions struct { // The desired storage type
|
||||
|
||||
// {resource}.{group} = 1|2|3|4
|
||||
UnifiedStorageConfig map[string]setting.UnifiedStorageConfig
|
||||
|
||||
// TODO... this will be moved to UnifiedStorageConfig
|
||||
DualWriterDataSyncJobEnabled map[string]bool
|
||||
}
|
||||
|
||||
func NewStorageOptions() *StorageOptions {
|
||||
|
||||
Reference in New Issue
Block a user