Skip to content

Commit

Permalink
fix: add default port to enable SENTINEL_PORT environment (#999)
Browse files Browse the repository at this point in the history
* fix: add default port to enable `SENTINEL_PORT` environment

Signed-off-by: drivebyer <[email protected]>

* fix test

Signed-off-by: drivebyer <[email protected]>

---------

Signed-off-by: drivebyer <[email protected]>
  • Loading branch information
drivebyer authored Jun 19, 2024
1 parent 909d9e4 commit c58d54f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion k8sutils/redis-replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func generateRedisReplicationContainerParams(cr *redisv1beta2.RedisReplication)
ImagePullPolicy: cr.Spec.KubernetesConfig.ImagePullPolicy,
Resources: cr.Spec.KubernetesConfig.Resources,
SecurityContext: cr.Spec.SecurityContext,
Port: ptr.To(6379),
Port: ptr.To(redisPort),
}
if cr.Spec.EnvVars != nil {
containerProp.EnvVars = cr.Spec.EnvVars
Expand Down
1 change: 1 addition & 0 deletions k8sutils/redis-sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func generateRedisSentinelContainerParams(ctx context.Context, client kubernetes
ImagePullPolicy: cr.Spec.KubernetesConfig.ImagePullPolicy,
Resources: cr.Spec.KubernetesConfig.Resources,
SecurityContext: cr.Spec.SecurityContext,
Port: ptr.To(sentinelPort),
AdditionalEnvVariable: getSentinelEnvVariable(ctx, client, logger, cr, dcl),
}
if cr.Spec.EnvVars != nil {
Expand Down
1 change: 1 addition & 0 deletions k8sutils/redis-sentinel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ func Test_generateRedisSentinelContainerParams(t *testing.T) {
Value: "custom_value_2",
},
},
Port: ptr.To(26379),
AdditionalVolume: []v1.Volume{
{
Name: "redis-config",
Expand Down
2 changes: 1 addition & 1 deletion k8sutils/redis-standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func generateRedisStandaloneContainerParams(cr *redisv1beta2.Redis) containerPar
ImagePullPolicy: cr.Spec.KubernetesConfig.ImagePullPolicy,
Resources: cr.Spec.KubernetesConfig.Resources,
SecurityContext: cr.Spec.SecurityContext,
Port: ptr.To(6379),
Port: ptr.To(redisPort),
}

if cr.Spec.EnvVars != nil {
Expand Down

0 comments on commit c58d54f

Please sign in to comment.