diff --git a/cmd/cmd.go b/cmd/cmd.go index dccf548..31ba527 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -90,12 +90,15 @@ func run(ctx context.Context, args []string) error { Host: dbHost, Port: dbPort, } + klog.Info("\nuser:", dbUser, "\nhost:", dbHost, "\nport:", dbPort, "\n") identityServer, databaseProvisioner := driver.NewDriver(provisionerName, postgresDB) server, err := provisioner.NewDefaultProvisionerServer(driverAddress, identityServer, databaseProvisioner) if err != nil { + klog.Errorf("Failed to create provisioner server %v", err) return err } + klog.Info("Starting Postgres provisioner") return server.Run(ctx) } diff --git a/pkg/driver/driver.go b/pkg/driver/driver.go index 892796e..d5d8a6e 100644 --- a/pkg/driver/driver.go +++ b/pkg/driver/driver.go @@ -28,11 +28,13 @@ type ProvisionerServer struct { func (ps *ProvisionerServer) DriverCreateDatabase(_ context.Context, req *databasespec.DriverCreateDatabaseRequest) (*databasespec.DriverCreateDatabaseResponse, error) { if ps.postgresDB == nil { + klog.Errorf("Database not initialized") return &databasespec.DriverCreateDatabaseResponse{}, status.Error(codes.Internal, "Database not initialized") } databaseName := req.GetName() - klog.V(3).Info("Create Database", "name", databaseName) + klog.Info("Create Database", "name", databaseName) if err := ps.postgresDB.CreateDatabase(databaseName); err != nil { + klog.Errorf("Failed to create database %v", err) return &databasespec.DriverCreateDatabaseResponse{}, err } @@ -43,9 +45,12 @@ func (ps *ProvisionerServer) DriverCreateDatabase(_ context.Context, req *databa func (ps *ProvisionerServer) DriverDeleteDatabase(_ context.Context, req *databasespec.DriverDeleteDatabaseRequest) (*databasespec.DriverDeleteDatabaseResponse, error) { if ps.postgresDB == nil { + klog.Errorf("Database not initialized") return &databasespec.DriverDeleteDatabaseResponse{}, status.Error(codes.Internal, "Database not initialized") } + klog.Info("Delete Database", "name", req.DatabaseId) if err := ps.postgresDB.DeleteDatabase(req.DatabaseId); err != nil { + klog.Errorf("Failed to delete database %v", err) return &databasespec.DriverDeleteDatabaseResponse{}, err } @@ -55,6 +60,7 @@ func (ps *ProvisionerServer) DriverDeleteDatabase(_ context.Context, req *databa // This call grants access to an account. The account_name in the request shall be used as a unique identifier to create credentials. // The account_id returned in the response will be used as the unique identifier for deleting this access when calling DriverRevokeDatabaseAccess. func (ps *ProvisionerServer) DriverGrantDatabaseAccess(_ context.Context, req *databasespec.DriverGrantDatabaseAccessRequest) (*databasespec.DriverGrantDatabaseAccessResponse, error) { + klog.Info("Grant access", "name", req.DatabaseId) resp := &databasespec.DriverGrantDatabaseAccessResponse{ AccountId: req.DatabaseId, Credentials: map[string]*databasespec.CredentialDetails{},