mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Add Storage endpoint option
This commit is contained in:
parent
2d74e34297
commit
e9cd8adbf6
@ -23,6 +23,7 @@ type Server struct {
|
||||
ExtraSchedulerArgs cli.StringSlice
|
||||
ExtraControllerArgs cli.StringSlice
|
||||
Rootless bool
|
||||
StorageEndpoint string
|
||||
}
|
||||
|
||||
var ServerConfig Server
|
||||
@ -137,6 +138,12 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
|
||||
Usage: "(experimental) Run rootless",
|
||||
Destination: &ServerConfig.Rootless,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "storage-endpoint",
|
||||
Usage: "Specify Mysql, Postgres, or Sqlite (default) data source name",
|
||||
Destination: &ServerConfig.StorageEndpoint,
|
||||
EnvVar: "K3S_STORAGE_ENDPOINT",
|
||||
},
|
||||
NodeIPFlag,
|
||||
NodeNameFlag,
|
||||
DockerFlag,
|
||||
|
@ -24,7 +24,9 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/net"
|
||||
"k8s.io/kubernetes/pkg/volume/csi"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3" // ensure we have sqlite
|
||||
_ "github.com/go-sql-driver/mysql" // ensure we have mysql
|
||||
_ "github.com/lib/pq" // ensure we have postgres
|
||||
_ "github.com/mattn/go-sqlite3" // ensure we have sqlite
|
||||
)
|
||||
|
||||
func setupLogging(app *cli.Context) {
|
||||
@ -101,6 +103,7 @@ func run(app *cli.Context, cfg *cmds.Server) error {
|
||||
serverConfig.ControlConfig.ExtraControllerArgs = cfg.ExtraControllerArgs
|
||||
serverConfig.ControlConfig.ExtraSchedulerAPIArgs = cfg.ExtraSchedulerArgs
|
||||
serverConfig.ControlConfig.ClusterDomain = cfg.ClusterDomain
|
||||
serverConfig.ControlConfig.StorageEndpoint = cfg.StorageEndpoint
|
||||
|
||||
_, serverConfig.ControlConfig.ClusterIPRange, err = net2.ParseCIDR(cfg.ClusterCIDR)
|
||||
if err != nil {
|
||||
|
@ -70,10 +70,7 @@ type Control struct {
|
||||
KubeConfigMode string
|
||||
DataDir string
|
||||
Skips []string
|
||||
ETCDEndpoints []string
|
||||
ETCDKeyFile string
|
||||
ETCDCertFile string
|
||||
ETCDCAFile string
|
||||
StorageEndpoint string
|
||||
NoScheduler bool
|
||||
ExtraAPIArgs []string
|
||||
ExtraControllerArgs []string
|
||||
|
@ -146,18 +146,8 @@ func scheduler(cfg *config.Control, runtime *config.ControlRuntime) {
|
||||
|
||||
func apiServer(ctx context.Context, cfg *config.Control, runtime *config.ControlRuntime) (authenticator.Request, http.Handler, error) {
|
||||
argsMap := make(map[string]string)
|
||||
if len(cfg.ETCDEndpoints) > 0 {
|
||||
argsMap["storage-backend"] = "etcd3"
|
||||
argsMap["etcd-servers"] = strings.Join(cfg.ETCDEndpoints, ",")
|
||||
if cfg.ETCDKeyFile != "" {
|
||||
argsMap["etcd-keyfile"] = cfg.ETCDKeyFile
|
||||
}
|
||||
if cfg.ETCDCAFile != "" {
|
||||
argsMap["etcd-cafile"] = cfg.ETCDCAFile
|
||||
}
|
||||
if cfg.ETCDCertFile != "" {
|
||||
argsMap["etcd-certfile"] = cfg.ETCDCertFile
|
||||
}
|
||||
if len(cfg.StorageEndpoint) > 0 {
|
||||
argsMap["etcd-servers"] = cfg.StorageEndpoint
|
||||
}
|
||||
|
||||
certDir := filepath.Join(cfg.DataDir, "tls/temporary-certs")
|
||||
|
Loading…
Reference in New Issue
Block a user