mirror of https://github.com/k3s-io/k3s
Add cert storage backend flag
parent
28d9d83be2
commit
37582b6fac
|
@ -23,6 +23,7 @@ type Server struct {
|
||||||
ExtraSchedulerArgs cli.StringSlice
|
ExtraSchedulerArgs cli.StringSlice
|
||||||
ExtraControllerArgs cli.StringSlice
|
ExtraControllerArgs cli.StringSlice
|
||||||
Rootless bool
|
Rootless bool
|
||||||
|
CertStorageBackend string
|
||||||
StorageBackend string
|
StorageBackend string
|
||||||
StorageEndpoint string
|
StorageEndpoint string
|
||||||
StorageCAFile string
|
StorageCAFile string
|
||||||
|
@ -144,6 +145,11 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
|
||||||
Usage: "(experimental) Run rootless",
|
Usage: "(experimental) Run rootless",
|
||||||
Destination: &ServerConfig.Rootless,
|
Destination: &ServerConfig.Rootless,
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "cert-storage-backend",
|
||||||
|
Usage: "Specify storage type for storing certificate information",
|
||||||
|
Destination: &ServerConfig.CertStorageBackend,
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "storage-backend",
|
Name: "storage-backend",
|
||||||
Usage: "Specify storage type etcd3 or kvsql",
|
Usage: "Specify storage type etcd3 or kvsql",
|
||||||
|
|
|
@ -124,6 +124,7 @@ func run(app *cli.Context, cfg *cmds.Server) error {
|
||||||
serverConfig.ControlConfig.StorageKeyFile = cfg.StorageKeyFile
|
serverConfig.ControlConfig.StorageKeyFile = cfg.StorageKeyFile
|
||||||
serverConfig.ControlConfig.AdvertiseIP = cfg.AdvertiseIP
|
serverConfig.ControlConfig.AdvertiseIP = cfg.AdvertiseIP
|
||||||
serverConfig.ControlConfig.AdvertisePort = cfg.AdvertisePort
|
serverConfig.ControlConfig.AdvertisePort = cfg.AdvertisePort
|
||||||
|
serverConfig.ControlConfig.CertStorageBackend = cfg.CertStorageBackend
|
||||||
|
|
||||||
if serverConfig.ControlConfig.AdvertiseIP == "" && cmds.AgentConfig.NodeIP != "" {
|
if serverConfig.ControlConfig.AdvertiseIP == "" && cmds.AgentConfig.NodeIP != "" {
|
||||||
serverConfig.ControlConfig.AdvertiseIP = cmds.AgentConfig.NodeIP
|
serverConfig.ControlConfig.AdvertiseIP = cmds.AgentConfig.NodeIP
|
||||||
|
|
|
@ -81,6 +81,7 @@ type Control struct {
|
||||||
KubeConfigMode string
|
KubeConfigMode string
|
||||||
DataDir string
|
DataDir string
|
||||||
Skips []string
|
Skips []string
|
||||||
|
CertStorageBackend string
|
||||||
StorageBackend string
|
StorageBackend string
|
||||||
StorageEndpoint string
|
StorageEndpoint string
|
||||||
StorageCAFile string
|
StorageCAFile string
|
||||||
|
|
|
@ -31,9 +31,10 @@ type serverHA struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func setHAData(cfg *config.Control) error {
|
func setHAData(cfg *config.Control) error {
|
||||||
if cfg.StorageBackend != "etcd3" {
|
if cfg.StorageBackend != "etcd3" || cfg.CertStorageBackend != "etcd3" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoints := strings.Split(cfg.StorageEndpoint, ",")
|
endpoints := strings.Split(cfg.StorageEndpoint, ",")
|
||||||
cli, err := clientv3.New(clientv3.Config{
|
cli, err := clientv3.New(clientv3.Config{
|
||||||
Endpoints: endpoints,
|
Endpoints: endpoints,
|
||||||
|
@ -67,7 +68,7 @@ func setHAData(cfg *config.Control) error {
|
||||||
|
|
||||||
func getHAData(cfg *config.Control) error {
|
func getHAData(cfg *config.Control) error {
|
||||||
serverRuntime := &serverHA{}
|
serverRuntime := &serverHA{}
|
||||||
if cfg.StorageBackend != "etcd3" {
|
if cfg.StorageBackend != "etcd3" || cfg.CertStorageBackend != "etcd3" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
endpoints := strings.Split(cfg.StorageEndpoint, ",")
|
endpoints := strings.Split(cfg.StorageEndpoint, ",")
|
||||||
|
|
Loading…
Reference in New Issue