Setting sane defaults for ruler in SSD "read" mode (#6551)

Also removing support for configdb, since this is not supported but was the default storage type

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
pull/6804/head
Danny Kopping 3 years ago committed by GitHub
parent c340f3e202
commit 87e20d9399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      pkg/loki/modules.go
  2. 14
      pkg/ruler/base/storage.go

@ -781,17 +781,11 @@ func (t *Loki) initRulerStorage() (_ services.Service, err error) {
// unfortunately there is no way to generate a "default" config and compare default against actual
// to determine if it's unconfigured. the following check, however, correctly tests this.
// Single binary integration tests will break if this ever drifts
if t.Cfg.isModuleEnabled(All) && t.Cfg.Ruler.StoreConfig.IsDefaults() {
level.Info(util_log.Logger).Log("msg", "RulerStorage is not configured in single binary mode and will not be started.")
if (t.Cfg.isModuleEnabled(All) || t.Cfg.isModuleEnabled(Read)) && t.Cfg.Ruler.StoreConfig.IsDefaults() {
level.Info(util_log.Logger).Log("msg", "Ruler storage is not configured; ruler will not be started.")
return
}
// Loki doesn't support the configdb backend, but without excessive mangling/refactoring
// it's hard to enforce this at validation time. Therefore detect this and fail early.
if t.Cfg.Ruler.StoreConfig.Type == "configdb" {
return nil, errors.New("configdb is not supported as a Loki rules backend type")
}
// Make sure storage directory exists if using filesystem store
if t.Cfg.Ruler.StoreConfig.Type == "local" && t.Cfg.Ruler.StoreConfig.Local.Directory != "" {
err := chunk_util.EnsureDirectory(t.Cfg.Ruler.StoreConfig.Local.Directory)

@ -30,8 +30,7 @@ import (
// RuleStoreConfig configures a rule store.
// TODO remove this legacy config in Cortex 1.11.
type RuleStoreConfig struct {
Type string `yaml:"type"`
ConfigDB configClient.Config `yaml:"configdb"`
Type string `yaml:"type"`
// Object Storage Configs
Azure azure.BlobStorageConfig `yaml:"azure"`
@ -46,14 +45,13 @@ type RuleStoreConfig struct {
// RegisterFlags registers flags.
func (cfg *RuleStoreConfig) RegisterFlags(f *flag.FlagSet) {
cfg.ConfigDB.RegisterFlagsWithPrefix("ruler.", f)
cfg.Azure.RegisterFlagsWithPrefix("ruler.storage.", f)
cfg.GCS.RegisterFlagsWithPrefix("ruler.storage.", f)
cfg.S3.RegisterFlagsWithPrefix("ruler.storage.", f)
cfg.Swift.RegisterFlagsWithPrefix("ruler.storage.", f)
cfg.Local.RegisterFlagsWithPrefix("ruler.storage.", f)
cfg.BOS.RegisterFlagsWithPrefix("ruler.storage.", f)
f.StringVar(&cfg.Type, "ruler.storage.type", "configdb", "Method to use for backend rule storage (configdb, azure, gcs, s3, swift, local)")
f.StringVar(&cfg.Type, "ruler.storage.type", "", "Method to use for backend rule storage (configdb, azure, gcs, s3, swift, local)")
}
// Validate config and returns error on failure
@ -72,7 +70,7 @@ func (cfg *RuleStoreConfig) Validate() error {
// IsDefaults returns true if the storage options have not been set
func (cfg *RuleStoreConfig) IsDefaults() bool {
return cfg.Type == "configdb" && cfg.ConfigDB.ConfigsAPIURL.URL == nil
return cfg.Type == ""
}
// NewLegacyRuleStore returns a rule store backend client based on the provided cfg.
@ -91,12 +89,6 @@ func NewLegacyRuleStore(cfg RuleStoreConfig, hedgeCfg hedging.Config, clientMetr
var client client.ObjectClient
switch cfg.Type {
case "configdb":
c, err := configClient.New(cfg.ConfigDB)
if err != nil {
return nil, err
}
return configdb.NewConfigRuleStore(c), nil
case "azure":
client, err = azure.NewBlobStorage(&cfg.Azure, clientMetrics.AzureMetrics, hedgeCfg)
case "gcs":

Loading…
Cancel
Save