Skip to content
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

[ENH] Add system-catalog-provider to simplify deployment #1358

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go/coordinator/cmd/grpccoordinator/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var (

func init() {
flag.GRPCAddr(Cmd, &conf.BindAddress)
Cmd.Flags().StringVar(&conf.SystemCatalogProvider, "system-catalog-provider", "memory", "System catalog provider")
Cmd.Flags().StringVar(&conf.Username, "username", "root", "MetaTable username")
Cmd.Flags().StringVar(&conf.Password, "password", "", "MetaTable password")
Cmd.Flags().StringVar(&conf.Address, "db-address", "127.0.0.1:3306", "MetaTable db address")
Expand Down
38 changes: 25 additions & 13 deletions go/coordinator/internal/grpccoordinator/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package grpccoordinator

import (
"context"
"errors"

"github.com/chroma/chroma-coordinator/internal/coordinator"
"github.com/chroma/chroma-coordinator/internal/grpccoordinator/grpcutils"
"github.com/chroma/chroma-coordinator/internal/metastore/db/dbcore"
"github.com/chroma/chroma-coordinator/internal/proto/coordinatorpb"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
Expand All @@ -15,6 +17,9 @@ type Config struct {
// GRPC config
BindAddress string

// System catalog provider
SystemCatalogProvider string

// MetaTable config
Username string
Password string
Expand All @@ -39,19 +44,26 @@ type Server struct {
}

func New(config Config) (*Server, error) {
// dBConfig := dbcore.DBConfig{
// Username: config.Username,
// Password: config.Password,
// Address: config.Address,
// DBName: config.DBName,
// MaxIdleConns: config.MaxIdleConns,
// MaxOpenConns: config.MaxOpenConns,
// }
// db, err := dbcore.Connect(dBConfig)
// if err != nil {
// return nil, err
// }
return NewWithGrpcProvider(config, grpcutils.Default, nil)
if config.SystemCatalogProvider == "memory" {
return NewWithGrpcProvider(config, grpcutils.Default, nil)
} else if config.SystemCatalogProvider == "database" {
dBConfig := dbcore.DBConfig{
Username: config.Username,
Password: config.Password,
Address: config.Address,
DBName: config.DBName,
MaxIdleConns: config.MaxIdleConns,
MaxOpenConns: config.MaxOpenConns,
}
db, err := dbcore.Connect(dBConfig)
if err != nil {
return nil, err
}
return NewWithGrpcProvider(config, grpcutils.Default, db)
} else {
return nil, errors.New("invalid system catalog provider, only memory and database are supported")
}

}

func NewWithGrpcProvider(config Config, provider grpcutils.GrpcProvider, db *gorm.DB) (*Server, error) {
Expand Down
6 changes: 1 addition & 5 deletions k8s/deployment/kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,6 @@ spec:
- command:
- "chroma"
- "coordinator"
- "--db-address=aws.connect.psdb.cloud"
- "--username=pscale_user"
- "--password=pscale_password"
- "--db-name=test"
image: chroma-coordinator
imagePullPolicy: IfNotPresent
name: coordinator
Expand All @@ -293,4 +289,4 @@ spec:
targetPort: grpc
selector:
app: coordinator
type: ClusterIP
type: ClusterIP