@@ -22,6 +22,7 @@ import (
2222
2323 // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
2424 // to ensure that exec-entrypoint and run can make use of them.
25+
2526 "github.com/go-redis/redis"
2627 "github.com/jatalocks/kube-reqsizer/controllers"
2728 "github.com/jatalocks/kube-reqsizer/pkg/cache/rediscache"
@@ -81,18 +82,6 @@ func main() {
8182 flag .StringVar (& redisPassword , "redis-password" , "" , "Redis password" )
8283 flag .UintVar (& redisDB , "redis-db" , 0 , "Redis DB number" )
8384
84- redisClient := redis .NewClient (& redis.Options {
85- Addr : redisHost + ":" + redisPort ,
86- Password : redisPassword , // no password set
87- DB : int (redisDB ), // use default DB
88- })
89- log .Info (& redis.Options {
90- Addr : redisHost + ":" + redisPort ,
91- Password : redisPassword , // no password set
92- DB : int (redisDB ), // use default DB
93- })
94- log .Info (redisClient )
95-
9685 flag .BoolVar (& enableIncrease , "enable-increase" , true , "Enables the controller to increase pod requests" )
9786 flag .BoolVar (& enableReduce , "enable-reduce" , true , "Enables the controller to reduce pod requests" )
9887 flag .Int64Var (& maxMemory , "max-memory" , 0 , "Maximum memory in (Mi) that the controller can set a pod request to. 0 is infinite" )
@@ -120,6 +109,13 @@ func main() {
120109 opts .BindFlags (flag .CommandLine )
121110 flag .Parse ()
122111
112+ redisClient := redis .NewClient (& redis.Options {
113+ Addr : redisHost + ":" + redisPort ,
114+ Password : redisPassword , // no password set
115+ DB : int (redisDB ), // use default DB
116+ })
117+ log .Info (redisClient )
118+
123119 ctrl .SetLogger (zap .New (zap .UseFlagOptions (& opts )))
124120 mgr , err := ctrl .NewManager (ctrl .GetConfigOrDie (), ctrl.Options {
125121 Scheme : scheme ,
0 commit comments