-
Notifications
You must be signed in to change notification settings - Fork 279
Redis is a required part of our infra #2348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -383,17 +383,17 @@ func run(config cfg.Config, opts Options) (success bool) { | |
| RedisTLSCABase64: config.RedisTLSCABase64, | ||
| PoolSize: config.RedisPoolSize, | ||
| }) | ||
| if err != nil && !errors.Is(err, sharedFactories.ErrRedisDisabled) { | ||
| if err != nil { | ||
| logger.L().Fatal(ctx, "Could not connect to Redis", zap.Error(err)) | ||
| } else if err == nil { | ||
| closers = append(closers, closer{"redis client", func(context.Context) error { | ||
| return sharedFactories.CloseCleanly(redisClient) | ||
| }}) | ||
| } | ||
|
Comment on lines
+386
to
388
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 When neither RedisURL nor RedisClusterURL is set, NewRedisClient returns ErrRedisDisabled (no connection is ever attempted), but the new code logs 'Could not connect to Redis' — implying a network or auth failure. While zap.Error(err) will include 'redis is disabled' in the structured log, operators may waste time investigating connectivity instead of checking for a missing env var. Consider detecting ErrRedisDisabled explicitly and logging 'Redis is required but not configured'. Extended reasoning...What the bug is: When neither The specific code path: Why existing code doesn't prevent it: The Impact: An operator whose deploy fails because they forgot to set Addressing the refutation: The refutation is correct that the behavior (fatal exit when Redis is unconfigured) is intentional and correct — this PR explicitly makes Redis required. The bug is only in the diagnostic quality of the log message. The fix does not change semantics; it simply distinguishes the two failure modes. Proof (concrete example): Deploy orchestrator without setting any Redis env vars → Fix: |
||
|
|
||
| closers = append(closers, closer{"redis client", func(context.Context) error { | ||
| return sharedFactories.CloseCleanly(redisClient) | ||
| }}) | ||
|
|
||
| peerRegistry := peerclient.NopRegistry() | ||
| peerResolver := peerclient.NopResolver() | ||
| if nodeAddress := config.NodeAddress(); redisClient != nil && nodeAddress != nil { | ||
| if nodeAddress := config.NodeAddress(); nodeAddress != nil { | ||
| peerRegistry = peerclient.NewRedisRegistry(redisClient, *nodeAddress) | ||
| peerResolver = peerclient.NewResolver(peerRegistry, *nodeAddress) | ||
| } | ||
|
|
@@ -453,11 +453,9 @@ func run(config cfg.Config, opts Options) (success bool) { | |
| logger.L().Info(ctx, "cgroup accounting enabled", zap.String("root", cgroup.RootCgroupPath)) | ||
|
|
||
| // Redis sandbox events delivery target | ||
| if redisClient != nil { | ||
| sbxEventsDeliveryRedis := event.NewRedisStreamsDelivery[event.SandboxEvent](redisClient, event.SandboxEventsStreamName) | ||
| sbxEventsDeliveryTargets = append(sbxEventsDeliveryTargets, sbxEventsDeliveryRedis) | ||
| closers = append(closers, closer{"sandbox events delivery for redis", sbxEventsDeliveryRedis.Close}) | ||
| } | ||
| sbxEventsDeliveryRedis := event.NewRedisStreamsDelivery[event.SandboxEvent](redisClient, event.SandboxEventsStreamName) | ||
| sbxEventsDeliveryTargets = append(sbxEventsDeliveryTargets, sbxEventsDeliveryRedis) | ||
| closers = append(closers, closer{"sandbox events delivery for redis", sbxEventsDeliveryRedis.Close}) | ||
|
|
||
| // sandbox observer | ||
| sandboxObserver, err := metrics.NewSandboxObserver(ctx, nodeID, serviceName, commitSHA, version, serviceInstanceID, sandboxes) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/5
client-proxy/main.gostill has a similar check, should it be eliminated also?