Skip to content

Commit 70a35af

Browse files
committed
kubedb: support all databases KubeDB provides (30 engines)
Expand the engine registry from Postgres/Qdrant to every kind in kubedb.dev/apimachinery (apis/kubedb): GA kinds under kubedb.com/v1, the rest under kubedb.com/v1alpha2, with resource plural, default client ports, and auth-shape hint per engine. Add a registry completeness test. Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent d051706 commit 70a35af

2 files changed

Lines changed: 79 additions & 22 deletions

File tree

kubedb/engines.go

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import (
77
)
88

99
// Engine describes the KubeDB coordinates for a single database kind. Values here
10-
// mirror the per-engine appendix of the integration guide; the group/version is the
11-
// deployment-specific part and should be confirmed against `available-types`.
10+
// are derived from kubedb.dev/apimachinery (apis/kubedb): a kind served under the GA
11+
// group version uses "v1"; the remaining kinds use "v1alpha2". Confirm availability
12+
// for a given cluster via `available-types`.
1213
type Engine struct {
1314
// Name is the canonical lower-case engine name, e.g. "postgres".
1415
Name string
@@ -17,31 +18,51 @@ type Engine struct {
1718
Version string
1819
Kind string
1920
Resource string
20-
// Ports are the engine's default service ports (informational, for connection info).
21+
// Ports are the engine's default client service ports (informational).
2122
Ports []int
22-
// AuthType hints how connection credentials are shaped: "password" or "apikey".
23+
// AuthType hints how connection credentials are shaped: "password", "apikey"
24+
// or "none".
2325
AuthType string
2426
}
2527

28+
const group = "kubedb.com"
29+
30+
// engines is the full set of databases KubeDB supports. Kinds served under the GA
31+
// group version use "v1"; the rest use "v1alpha2".
2632
var engines = map[string]Engine{
27-
"postgres": {
28-
Name: "postgres",
29-
Group: "kubedb.com",
30-
Version: "v1",
31-
Kind: "Postgres",
32-
Resource: "postgreses",
33-
Ports: []int{5432},
34-
AuthType: "password",
35-
},
36-
"qdrant": {
37-
Name: "qdrant",
38-
Group: "kubedb.com",
39-
Version: "v1alpha2",
40-
Kind: "Qdrant",
41-
Resource: "qdrants",
42-
Ports: []int{6333, 6334},
43-
AuthType: "apikey",
44-
},
33+
// --- kubedb.com/v1 (GA) ---
34+
"elasticsearch": {Name: "elasticsearch", Group: group, Version: "v1", Kind: "Elasticsearch", Resource: "elasticsearches", Ports: []int{9200}, AuthType: "password"},
35+
"kafka": {Name: "kafka", Group: group, Version: "v1", Kind: "Kafka", Resource: "kafkas", Ports: []int{9092}, AuthType: "password"},
36+
"mariadb": {Name: "mariadb", Group: group, Version: "v1", Kind: "MariaDB", Resource: "mariadbs", Ports: []int{3306}, AuthType: "password"},
37+
"memcached": {Name: "memcached", Group: group, Version: "v1", Kind: "Memcached", Resource: "memcacheds", Ports: []int{11211}, AuthType: "none"},
38+
"mongodb": {Name: "mongodb", Group: group, Version: "v1", Kind: "MongoDB", Resource: "mongodbs", Ports: []int{27017}, AuthType: "password"},
39+
"mysql": {Name: "mysql", Group: group, Version: "v1", Kind: "MySQL", Resource: "mysqls", Ports: []int{3306}, AuthType: "password"},
40+
"perconaxtradb": {Name: "perconaxtradb", Group: group, Version: "v1", Kind: "PerconaXtraDB", Resource: "perconaxtradbs", Ports: []int{3306}, AuthType: "password"},
41+
"pgbouncer": {Name: "pgbouncer", Group: group, Version: "v1", Kind: "PgBouncer", Resource: "pgbouncers", Ports: []int{5432}, AuthType: "password"},
42+
"postgres": {Name: "postgres", Group: group, Version: "v1", Kind: "Postgres", Resource: "postgreses", Ports: []int{5432}, AuthType: "password"},
43+
"proxysql": {Name: "proxysql", Group: group, Version: "v1", Kind: "ProxySQL", Resource: "proxysqls", Ports: []int{6033}, AuthType: "password"},
44+
"redis": {Name: "redis", Group: group, Version: "v1", Kind: "Redis", Resource: "redises", Ports: []int{6379}, AuthType: "password"},
45+
"redissentinel": {Name: "redissentinel", Group: group, Version: "v1", Kind: "RedisSentinel", Resource: "redissentinels", Ports: []int{26379}, AuthType: "password"},
46+
47+
// --- kubedb.com/v1alpha2 ---
48+
"aerospike": {Name: "aerospike", Group: group, Version: "v1alpha2", Kind: "Aerospike", Resource: "aerospikes", Ports: []int{3000}, AuthType: "password"},
49+
"cassandra": {Name: "cassandra", Group: group, Version: "v1alpha2", Kind: "Cassandra", Resource: "cassandras", Ports: []int{9042}, AuthType: "password"},
50+
"clickhouse": {Name: "clickhouse", Group: group, Version: "v1alpha2", Kind: "ClickHouse", Resource: "clickhouses", Ports: []int{9000, 8123}, AuthType: "password"},
51+
"documentdb": {Name: "documentdb", Group: group, Version: "v1alpha2", Kind: "DocumentDB", Resource: "documentdbs", Ports: []int{10260}, AuthType: "password"},
52+
"druid": {Name: "druid", Group: group, Version: "v1alpha2", Kind: "Druid", Resource: "druids", Ports: []int{8888}, AuthType: "password"},
53+
"hanadb": {Name: "hanadb", Group: group, Version: "v1alpha2", Kind: "HanaDB", Resource: "hanadbs", Ports: []int{39017}, AuthType: "password"},
54+
"hazelcast": {Name: "hazelcast", Group: group, Version: "v1alpha2", Kind: "Hazelcast", Resource: "hazelcasts", Ports: []int{5701}, AuthType: "password"},
55+
"ignite": {Name: "ignite", Group: group, Version: "v1alpha2", Kind: "Ignite", Resource: "ignites", Ports: []int{10800}, AuthType: "password"},
56+
"milvus": {Name: "milvus", Group: group, Version: "v1alpha2", Kind: "Milvus", Resource: "milvuses", Ports: []int{19530}, AuthType: "apikey"},
57+
"mssqlserver": {Name: "mssqlserver", Group: group, Version: "v1alpha2", Kind: "MSSQLServer", Resource: "mssqlservers", Ports: []int{1433}, AuthType: "password"},
58+
"oracle": {Name: "oracle", Group: group, Version: "v1alpha2", Kind: "Oracle", Resource: "oracles", Ports: []int{1521}, AuthType: "password"},
59+
"pgpool": {Name: "pgpool", Group: group, Version: "v1alpha2", Kind: "Pgpool", Resource: "pgpools", Ports: []int{9999}, AuthType: "password"},
60+
"qdrant": {Name: "qdrant", Group: group, Version: "v1alpha2", Kind: "Qdrant", Resource: "qdrants", Ports: []int{6333, 6334}, AuthType: "apikey"},
61+
"rabbitmq": {Name: "rabbitmq", Group: group, Version: "v1alpha2", Kind: "RabbitMQ", Resource: "rabbitmqs", Ports: []int{5672, 15672}, AuthType: "password"},
62+
"singlestore": {Name: "singlestore", Group: group, Version: "v1alpha2", Kind: "Singlestore", Resource: "singlestores", Ports: []int{3306}, AuthType: "password"},
63+
"solr": {Name: "solr", Group: group, Version: "v1alpha2", Kind: "Solr", Resource: "solrs", Ports: []int{8983}, AuthType: "password"},
64+
"weaviate": {Name: "weaviate", Group: group, Version: "v1alpha2", Kind: "Weaviate", Resource: "weaviates", Ports: []int{8080, 50051}, AuthType: "apikey"},
65+
"zookeeper": {Name: "zookeeper", Group: group, Version: "v1alpha2", Kind: "ZooKeeper", Resource: "zookeepers", Ports: []int{2181}, AuthType: "password"},
4566
}
4667

4768
// Lookup returns the Engine for a name (case-insensitive) or an error listing

kubedb/engines_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package kubedb
2+
3+
import "testing"
4+
5+
func TestEngines_Complete(t *testing.T) {
6+
if got := len(SupportedEngines()); got != 30 {
7+
t.Fatalf("expected 30 supported engines, got %d", got)
8+
}
9+
for _, name := range SupportedEngines() {
10+
e, err := Lookup(name)
11+
if err != nil {
12+
t.Fatalf("Lookup(%q): %v", name, err)
13+
}
14+
if e.Group != "kubedb.com" {
15+
t.Errorf("%s: group = %q, want kubedb.com", name, e.Group)
16+
}
17+
if e.Version != "v1" && e.Version != "v1alpha2" {
18+
t.Errorf("%s: version = %q, want v1 or v1alpha2", name, e.Version)
19+
}
20+
if e.Kind == "" || e.Resource == "" {
21+
t.Errorf("%s: missing kind/resource: %+v", name, e)
22+
}
23+
if len(e.Ports) == 0 {
24+
t.Errorf("%s: no ports", name)
25+
}
26+
}
27+
}
28+
29+
func TestLookup_CaseInsensitiveAndUnknown(t *testing.T) {
30+
if e, err := Lookup("PostGres"); err != nil || e.Kind != "Postgres" {
31+
t.Fatalf("case-insensitive lookup failed: %+v, %v", e, err)
32+
}
33+
if _, err := Lookup("cockroach"); err == nil {
34+
t.Fatalf("expected error for unknown engine")
35+
}
36+
}

0 commit comments

Comments
 (0)