mirror of https://github.com/k3s-io/k3s
vendor update
parent
9efbeb11e4
commit
e82b62cbab
|
@ -123,7 +123,7 @@ golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631
|
||||||
gopkg.in/inf.v0 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
|
gopkg.in/inf.v0 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
|
||||||
gopkg.in/yaml.v2 v2.2.1
|
gopkg.in/yaml.v2 v2.2.1
|
||||||
#github.com/ibuildthecloud/kvsql 788464096f5af361d166858efccf26c12dc5b427
|
#github.com/ibuildthecloud/kvsql 788464096f5af361d166858efccf26c12dc5b427
|
||||||
github.com/ibuildthecloud/kvsql d37dd2b0829b44a4964e48c9396e14b0536fefb6 https://github.com/erikwilson/rancher-kvsql.git
|
github.com/ibuildthecloud/kvsql 1afc2d8ad7d7e263c1971b05cb37e83aa5562561 https://github.com/erikwilson/rancher-kvsql.git
|
||||||
|
|
||||||
# rootless
|
# rootless
|
||||||
github.com/rootless-containers/rootlesskit 893c1c3de71f54c301fdb85a7c0dd15c1933c159
|
github.com/rootless-containers/rootlesskit 893c1c3de71f54c301fdb85a7c0dd15c1933c159
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package mysql
|
package mysql
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ func NewMySQL() *driver.Generic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Open(dataSourceName string) (*sql.DB, error) {
|
func Open(dataSourceName string, tlsConfig *tls.Config) (*sql.DB, error) {
|
||||||
if dataSourceName == "" {
|
if dataSourceName == "" {
|
||||||
dataSourceName = "root@unix(/var/run/mysqld/mysqld.sock)/"
|
dataSourceName = "root@unix(/var/run/mysqld/mysqld.sock)/"
|
||||||
}
|
}
|
||||||
|
@ -77,6 +78,17 @@ func Open(dataSourceName string) (*sql.DB, error) {
|
||||||
}
|
}
|
||||||
dataSourceName = dataSourceName + "kubernetes"
|
dataSourceName = dataSourceName + "kubernetes"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setting up tlsConfig
|
||||||
|
if tlsConfig != nil {
|
||||||
|
mysql.RegisterTLSConfig("custom", tlsConfig)
|
||||||
|
if strings.Contains(dataSourceName, "?") {
|
||||||
|
dataSourceName = dataSourceName + ",tls=custom"
|
||||||
|
} else {
|
||||||
|
dataSourceName = dataSourceName + "?tls=custom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
db, err := sql.Open("mysql", dataSourceName)
|
db, err := sql.Open("mysql", dataSourceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -68,6 +68,8 @@ func NewPGSQL() *driver.Generic {
|
||||||
func Open(dataSourceName string) (*sql.DB, error) {
|
func Open(dataSourceName string) (*sql.DB, error) {
|
||||||
if dataSourceName == "" {
|
if dataSourceName == "" {
|
||||||
dataSourceName = "postgres://postgres:postgres@localhost/"
|
dataSourceName = "postgres://postgres:postgres@localhost/"
|
||||||
|
} else {
|
||||||
|
dataSourceName = "postgres://" + dataSourceName
|
||||||
}
|
}
|
||||||
// get database name
|
// get database name
|
||||||
dsList := strings.Split(dataSourceName, "/")
|
dsList := strings.Split(dataSourceName, "/")
|
||||||
|
|
|
@ -115,7 +115,7 @@ func newKV(cfg Config) (*kv, error) {
|
||||||
}
|
}
|
||||||
driver = sqlite.NewSQLite()
|
driver = sqlite.NewSQLite()
|
||||||
case "mysql":
|
case "mysql":
|
||||||
if db, err = mysql.Open(parts[1]); err != nil {
|
if db, err = mysql.Open(parts[1], cfg.TLS); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
driver = mysql.NewMySQL()
|
driver = mysql.NewMySQL()
|
||||||
|
|
|
@ -18,12 +18,14 @@ package factory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/coreos/etcd/pkg/transport"
|
||||||
"github.com/ibuildthecloud/kvsql/clientv3"
|
"github.com/ibuildthecloud/kvsql/clientv3"
|
||||||
"github.com/ibuildthecloud/kvsql/storage"
|
etcd3 "github.com/ibuildthecloud/kvsql/storage"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/apiserver/pkg/storage"
|
"k8s.io/apiserver/pkg/storage"
|
||||||
"k8s.io/apiserver/pkg/storage/storagebackend"
|
"k8s.io/apiserver/pkg/storage/storagebackend"
|
||||||
|
@ -65,8 +67,22 @@ func NewKVSQLHealthCheck(c storagebackend.Config) (func() error, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func newETCD3Client(c storagebackend.Config) (*clientv3.Client, error) {
|
func newETCD3Client(c storagebackend.Config) (*clientv3.Client, error) {
|
||||||
|
tlsInfo := transport.TLSInfo{
|
||||||
|
CertFile: c.Transport.CertFile,
|
||||||
|
KeyFile: c.Transport.KeyFile,
|
||||||
|
CAFile: c.Transport.CAFile,
|
||||||
|
}
|
||||||
|
tlsConfig, err := tlsInfo.ClientConfig()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
tlsConfig.MinVersion = tls.VersionTLS11
|
||||||
|
if len(c.Transport.CertFile) == 0 && len(c.Transport.KeyFile) == 0 && len(c.Transport.CAFile) == 0 {
|
||||||
|
tlsConfig = nil
|
||||||
|
}
|
||||||
cfg := clientv3.Config{
|
cfg := clientv3.Config{
|
||||||
Endpoints: c.Transport.ServerList,
|
Endpoints: c.Transport.ServerList,
|
||||||
|
TLS: tlsConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(cfg.Endpoints) == 0 {
|
if len(cfg.Endpoints) == 0 {
|
||||||
|
|
Loading…
Reference in New Issue