Skip to content

Commit b59b87f

Browse files
authored
chore: disable unsupported redis subcommand to suppress warning (#647)
Signed-off-by: Jonathan West <jonwest@redhat.com>
1 parent 09584aa commit b59b87f

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

agent/inbound_redis.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/argoproj-labs/argocd-agent/internal/logging/logfields"
2828
rediscache "github.com/go-redis/cache/v9"
2929
"github.com/redis/go-redis/v9"
30+
"github.com/redis/go-redis/v9/maintnotifications"
3031
"github.com/sirupsen/logrus"
3132
)
3233

@@ -341,6 +342,9 @@ func (a *Agent) getRedisClientAndCache() (*redis.Client, *rediscache.Cache, erro
341342
MaxRetries: 3,
342343
TLSConfig: tlsConfig,
343344
Username: a.redisProxyMsgHandler.redisUsername,
345+
MaintNotificationsConfig: &maintnotifications.Config{
346+
Mode: maintnotifications.ModeDisabled,
347+
},
344348
}
345349

346350
client := redis.NewClient(opts)

internal/argocd/cluster/cluster.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121

2222
"github.com/argoproj-labs/argocd-agent/internal/event"
2323
"github.com/redis/go-redis/v9"
24+
"github.com/redis/go-redis/v9/maintnotifications"
2425
"github.com/sirupsen/logrus"
2526

2627
appv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
@@ -166,7 +167,13 @@ func (m *Manager) setClusterInfo(clusterServer, agentName, clusterName string, c
166167
// NewClusterCacheInstance creates a new cache instance with Redis connection
167168
func NewClusterCacheInstance(redisAddress, redisPassword string, redisCompressionType cacheutil.RedisCompressionType) (*appstatecache.Cache, error) {
168169

169-
redisOptions := &redis.Options{Addr: redisAddress, Password: redisPassword}
170+
redisOptions := &redis.Options{
171+
Addr: redisAddress,
172+
Password: redisPassword,
173+
MaintNotificationsConfig: &maintnotifications.Config{
174+
Mode: maintnotifications.ModeDisabled,
175+
},
176+
}
170177
redisClient := redis.NewClient(redisOptions)
171178

172179
clusterCache := appstatecache.NewCache(cacheutil.NewCache(

test/e2e/fixture/cluster.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
cacheutil "github.com/argoproj/argo-cd/v3/util/cache"
2424
appstatecache "github.com/argoproj/argo-cd/v3/util/cache/appstate"
2525
"github.com/redis/go-redis/v9"
26+
"github.com/redis/go-redis/v9/maintnotifications"
2627
corev1 "k8s.io/api/core/v1"
2728
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2829
"k8s.io/apimachinery/pkg/types"
@@ -163,9 +164,15 @@ func getCacheInstance(source string, clusterDetails *ClusterDetails) *appstateca
163164
case PrincipalName:
164165
redisOptions.Addr = clusterDetails.PrincipalRedisAddr
165166
redisOptions.Password = clusterDetails.PrincipalRedisPassword
167+
redisOptions.MaintNotificationsConfig = &maintnotifications.Config{
168+
Mode: maintnotifications.ModeDisabled,
169+
}
166170
case AgentManagedName:
167171
redisOptions.Addr = clusterDetails.ManagedAgentRedisAddr
168172
redisOptions.Password = clusterDetails.ManagedAgentRedisPassword
173+
redisOptions.MaintNotificationsConfig = &maintnotifications.Config{
174+
Mode: maintnotifications.ModeDisabled,
175+
}
169176
default:
170177
panic(fmt.Sprintf("invalid source: %s", source))
171178
}

0 commit comments

Comments
 (0)