Commit 8a0718a6 authored by Darren Shepherd's avatar Darren Shepherd

Add support for SQL driver

parent 9eb6d525
...@@ -25,6 +25,7 @@ import ( ...@@ -25,6 +25,7 @@ import (
const ( const (
StorageTypeUnset = "" StorageTypeUnset = ""
StorageTypeKVSQL = "kvsql"
StorageTypeETCD2 = "etcd2" StorageTypeETCD2 = "etcd2"
StorageTypeETCD3 = "etcd3" StorageTypeETCD3 = "etcd3"
......
...@@ -19,6 +19,7 @@ package factory ...@@ -19,6 +19,7 @@ package factory
import ( import (
"fmt" "fmt"
"github.com/ibuildthecloud/kvsql"
"k8s.io/apiserver/pkg/storage" "k8s.io/apiserver/pkg/storage"
"k8s.io/apiserver/pkg/storage/storagebackend" "k8s.io/apiserver/pkg/storage/storagebackend"
) )
...@@ -29,7 +30,9 @@ type DestroyFunc func() ...@@ -29,7 +30,9 @@ type DestroyFunc func()
// Create creates a storage backend based on given config. // Create creates a storage backend based on given config.
func Create(c storagebackend.Config) (storage.Interface, DestroyFunc, error) { func Create(c storagebackend.Config) (storage.Interface, DestroyFunc, error) {
switch c.Type { switch c.Type {
case storagebackend.StorageTypeUnset, storagebackend.StorageTypeETCD3: case storagebackend.StorageTypeUnset, storagebackend.StorageTypeKVSQL:
return factory.NewKVSQLStorage(c)
case storagebackend.StorageTypeETCD3:
// TODO: We have the following features to implement: // TODO: We have the following features to implement:
// - Support secure connection by using key, cert, and CA files. // - Support secure connection by using key, cert, and CA files.
// - Honor "https" scheme to support secure connection in gRPC. // - Honor "https" scheme to support secure connection in gRPC.
...@@ -43,7 +46,9 @@ func Create(c storagebackend.Config) (storage.Interface, DestroyFunc, error) { ...@@ -43,7 +46,9 @@ func Create(c storagebackend.Config) (storage.Interface, DestroyFunc, error) {
// CreateHealthCheck creates a healthcheck function based on given config. // CreateHealthCheck creates a healthcheck function based on given config.
func CreateHealthCheck(c storagebackend.Config) (func() error, error) { func CreateHealthCheck(c storagebackend.Config) (func() error, error) {
switch c.Type { switch c.Type {
case storagebackend.StorageTypeUnset, storagebackend.StorageTypeETCD3: case storagebackend.StorageTypeUnset, storagebackend.StorageTypeKVSQL:
return factory.NewKVSQLHealthCheck(c)
case storagebackend.StorageTypeETCD3:
return newETCD3HealthCheck(c) return newETCD3HealthCheck(c)
default: default:
return nil, fmt.Errorf("unknown storage type: %s", c.Type) return nil, fmt.Errorf("unknown storage type: %s", c.Type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment