Skip to content

Commit

Permalink
fix(cli): Get Redis password from secret in loadClusters() (#18951) (
Browse files Browse the repository at this point in the history
…#18955)

* Get Redis password from secret in `loadClusters()`



* feat: support redis password in admin stats command



* Simplify code



---------

Signed-off-by: David Wu <[email protected]>
Signed-off-by: pashakostohrys <[email protected]>
Co-authored-by: david-wu-octopus <[email protected]>
Co-authored-by: pashakostohrys <[email protected]>
  • Loading branch information
3 people authored Jul 5, 2024
1 parent beacacc commit 065f849
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/argocd/commands/admin/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,17 @@ func loadClusters(ctx context.Context, kubeClient *kubernetes.Clientset, appClie
if err != nil {
return nil, err
}
client := redis.NewClient(&redis.Options{Addr: fmt.Sprintf("localhost:%d", port)})

redisOptions := &redis.Options{Addr: fmt.Sprintf("localhost:%d", port)}

secret, err := kubeClient.CoreV1().Secrets(namespace).Get(context.Background(), defaulRedisInitialPasswordSecretName, v1.GetOptions{})
if err == nil {
if _, ok := secret.Data[defaultResisInitialPasswordKey]; ok {
redisOptions.Password = string(secret.Data[defaultResisInitialPasswordKey])
}
}

client := redis.NewClient(redisOptions)
compressionType, err := cacheutil.CompressionTypeFromString(redisCompressionStr)
if err != nil {
return nil, err
Expand Down

0 comments on commit 065f849

Please sign in to comment.