forked from flyteorg/flytepropeller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
49 lines (38 loc) · 1.32 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package config
import (
"github.com/lyft/flytepropeller/pkg/controller/config"
)
//go:generate pflags Config --default-var=defaultConfig
const configSectionKey = "resourcemanager"
type Type = string
const (
TypeNoop Type = "noop"
TypeRedis Type = "redis"
)
var (
defaultConfig = Config{
Type: TypeNoop,
// TODO: Noop Resource Manager doesn't use MaxQuota. Maybe we can remove it?
ResourceMaxQuota: 1000,
}
configSection = config.MustRegisterSubSection(configSectionKey, &defaultConfig)
)
// Configs for Resource Manager
type Config struct {
Type Type `json:"type" pflag:"noop,Which resource manager to use"`
ResourceMaxQuota int `json:"resourceMaxQuota" pflag:",Global limit for concurrent Qubole queries"`
RedisConfig RedisConfig `json:"redis" pflag:",Config for Redist resourcemanager."`
}
// Specific configs for Redis resource manager
type RedisConfig struct {
HostPath string `json:"hostPath" pflag:",Redis host location"`
HostKey string `json:"hostKey" pflag:",Key for local Redis access"`
MaxRetries int `json:"maxRetries" pflag:",See Redis client options for more info"`
}
// Retrieves the current config value or default.
func GetConfig() *Config {
return configSection.GetConfig().(*Config)
}
func SetConfig(cfg *Config) error {
return configSection.SetConfig(cfg)
}