Skip to content

Commit 3115987

Browse files
authored
feat: add valkey support (#1604)
1 parent d1f6661 commit 3115987

File tree

8 files changed

+343
-309
lines changed

8 files changed

+343
-309
lines changed

src/pkg/cli/compose/stateful.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ var statefulImages = []string{
1717
"neo4j",
1818
"oracle/database",
1919
"percona",
20+
"pgvector",
2021
"postgres",
2122
"rabbitmq",
2223
"redis",
2324
"rethinkdb",
2425
"scylla",
2526
"timescaledb",
27+
"valkey",
2628
"vault",
2729
"zookeeper",
2830
}

src/pkg/cli/compose/validation.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ func validateService(svccfg *composeTypes.ServiceConfig, project *composeTypes.P
326326
redisExtension, managedRedis := svccfg.Extensions["x-defang-redis"]
327327
if managedRedis {
328328
// Ensure the repo is a valid Redis repo
329-
if !strings.HasSuffix(repo, "redis") {
330-
term.Warnf("service %q: managed Redis service should use a redis image", svccfg.Name)
329+
if !IsRedisRepo(repo) {
330+
term.Warnf("service %q: managed Redis service should use a redis or valkey image", svccfg.Name)
331331
}
332332
if _, err = validateManagedStore(redisExtension); err != nil {
333333
return fmt.Errorf("service %q: %w", svccfg.Name, err)
@@ -337,7 +337,7 @@ func validateService(svccfg *composeTypes.ServiceConfig, project *composeTypes.P
337337
postgresExtension, managedPostgres := svccfg.Extensions["x-defang-postgres"]
338338
if managedPostgres {
339339
// Ensure the repo is a valid Postgres repo
340-
if !strings.HasSuffix(repo, "postgres") && !strings.HasSuffix(repo, "pgvector") {
340+
if !IsPostgresRepo(repo) {
341341
term.Warnf("service %q: managed Postgres service should use a postgres image", svccfg.Name)
342342
}
343343
if _, err = validateManagedStore(postgresExtension); err != nil {
@@ -348,7 +348,7 @@ func validateService(svccfg *composeTypes.ServiceConfig, project *composeTypes.P
348348
mongodbExtension, managedMongodb := svccfg.Extensions["x-defang-mongodb"]
349349
if managedMongodb {
350350
// Ensure the repo is a valid MongoDB repo
351-
if !strings.HasSuffix(repo, "mongo") {
351+
if !IsMongoRepo(repo) {
352352
term.Warnf("service %q: managed MongoDB service should use a mongo image", svccfg.Name)
353353
}
354354
if _, err = validateManagedStore(mongodbExtension); err != nil {

src/protos/io/defang/v1/fabric.pb.go

Lines changed: 310 additions & 304 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/protos/io/defang/v1/fabric.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ enum ResourceType {
355355
RESOURCE_TYPE_AWS_ECS_EC2_SERVICE = 202;
356356
RESOURCE_TYPE_AWS_RDS_POSTGRES = 210;
357357
RESOURCE_TYPE_AWS_ELASTICACHE_REDIS = 220;
358+
RESOURCE_TYPE_AWS_ELASTICACHE_VALKEY = 221;
358359
RESOURCE_TYPE_AWS_DOCUMENTDB = 230;
359360
RESOURCE_TYPE_AWS_CLOUDFRONT_S3 = 240;
360361
RESOURCE_TYPE_AWS_BEDROCK = 250;

src/testdata/redis/compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ services:
3333
image: redis
3434
x-defang-redis:
3535
command: ["--port", "6380"]
36+
37+
valkey-service:
38+
image: valkey/valkey:latest
39+
x-defang-redis: true

src/testdata/redis/compose.yaml.fixup

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@
6363
}
6464
]
6565
},
66+
"valkey-service": {
67+
"command": null,
68+
"entrypoint": null,
69+
"image": "valkey/valkey:latest",
70+
"networks": {
71+
"default": null
72+
},
73+
"ports": [
74+
{
75+
"mode": "host",
76+
"target": 6379,
77+
"protocol": "tcp"
78+
}
79+
]
80+
},
6681
"with-ext": {
6782
"command": null,
6883
"entrypoint": null,

src/testdata/redis/compose.yaml.golden

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ services:
3131
published: "6379"
3232
protocol: tcp
3333
x-defang-redis: null
34+
valkey-service:
35+
image: valkey/valkey:latest
36+
networks:
37+
default: null
38+
x-defang-redis: true
3439
with-ext:
3540
image: redis
3641
networks:

src/testdata/redis/compose.yaml.warnings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
! service "no-ports": missing memory reservation; using provider-specific defaults. Specify deploy.resources.reservations.memory to avoid out-of-memory errors
44
! service "no-ports-override": missing memory reservation; using provider-specific defaults. Specify deploy.resources.reservations.memory to avoid out-of-memory errors
55
! service "short-ports": missing memory reservation; using provider-specific defaults. Specify deploy.resources.reservations.memory to avoid out-of-memory errors
6+
! service "valkey-service": missing memory reservation; using provider-specific defaults. Specify deploy.resources.reservations.memory to avoid out-of-memory errors
67
! service "with-ext": missing memory reservation; using provider-specific defaults. Specify deploy.resources.reservations.memory to avoid out-of-memory errors
7-
! service "wrong-image": managed Redis service should use a redis image
8+
! service "wrong-image": managed Redis service should use a redis or valkey image
89
! service "wrong-image": missing memory reservation; using provider-specific defaults. Specify deploy.resources.reservations.memory to avoid out-of-memory errors

0 commit comments

Comments
 (0)