@@ -3,6 +3,7 @@ package utils
33import (
44 "flag"
55 "fmt"
6+ v1 "github.com/spotahome/redis-operator/api/redisfailover/v1"
67 "path/filepath"
78 "regexp"
89
@@ -13,15 +14,18 @@ import (
1314// CMDFlags are the flags used by the cmd
1415// TODO: improve flags.
1516type CMDFlags struct {
16- KubeConfig string
17- SupportedNamespacesRegex string
18- Development bool
19- ListenAddr string
20- MetricsPath string
21- K8sQueriesPerSecond int
22- K8sQueriesBurstable int
23- Concurrency int
24- LogLevel string
17+ KubeConfig string
18+ SupportedNamespacesRegex string
19+ Development bool
20+ ListenAddr string
21+ MetricsPath string
22+ K8sQueriesPerSecond int
23+ K8sQueriesBurstable int
24+ Concurrency int
25+ LogLevel string
26+ DefaultRedisImage string
27+ DefaultRedisExporterImage string
28+ DefaultSentinelExporterImage string
2529}
2630
2731// Init initializes and parse the flags
@@ -39,6 +43,9 @@ func (c *CMDFlags) Init() {
3943 // reference: https://github.com/spotahome/kooper/blob/master/controller/controller.go#L89
4044 flag .IntVar (& c .Concurrency , "concurrency" , 3 , "Number of conccurent workers meant to process events" )
4145 flag .StringVar (& c .LogLevel , "log-level" , "info" , "set log level" )
46+ flag .StringVar (& c .DefaultRedisImage , "redis-default-image" , v1 .DefaultImage , "default redis image" )
47+ flag .StringVar (& c .DefaultRedisExporterImage , "rfr-exporter-default-image" , v1 .DefaultExporterImage , "default redis exporter image" )
48+ flag .StringVar (& c .DefaultSentinelExporterImage , "rfs-exporter-default" , v1 .DefaultSentinelExporterImage , "default sentinel exporter image" )
4249 // Parse flags
4350 flag .Parse ()
4451
@@ -56,3 +63,10 @@ func (c *CMDFlags) ToRedisOperatorConfig() redisfailover.Config {
5663 SupportedNamespacesRegex : c .SupportedNamespacesRegex ,
5764 }
5865}
66+
67+ // ReinitiliazeDefaults redefine default values overridden by flags
68+ func (c * CMDFlags ) ReinitiliazeDefaults () {
69+ v1 .DefaultImage = c .DefaultRedisImage
70+ v1 .DefaultExporterImage = c .DefaultRedisExporterImage
71+ v1 .DefaultSentinelExporterImage = c .DefaultSentinelExporterImage
72+ }
0 commit comments