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
|
||||
ExtraControllerArgs cli.StringSlice
|
||||
Rootless bool
|
||||
CertStorageBackend string
|
||||
StorageBackend string
|
||||
StorageEndpoint string
|
||||
StorageCAFile string
|
||||
|
@ -144,6 +145,11 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
|
|||
Usage: "(experimental) Run rootless",
|
||||
Destination: &ServerConfig.Rootless,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "cert-storage-backend",
|
||||
Usage: "Specify storage type for storing certificate information",
|
||||
Destination: &ServerConfig.CertStorageBackend,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "storage-backend",
|
||||
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.AdvertiseIP = cfg.AdvertiseIP
|
||||
serverConfig.ControlConfig.AdvertisePort = cfg.AdvertisePort
|
||||
serverConfig.ControlConfig.CertStorageBackend = cfg.CertStorageBackend
|
||||
|
||||
if serverConfig.ControlConfig.AdvertiseIP == "" && cmds.AgentConfig.NodeIP != "" {
|
||||
serverConfig.ControlConfig.AdvertiseIP = cmds.AgentConfig.NodeIP
|
||||
|
|
|
@ -81,6 +81,7 @@ type Control struct {
|
|||
KubeConfigMode string
|
||||
DataDir string
|
||||
Skips []string
|
||||
CertStorageBackend string
|
||||
StorageBackend string
|
||||
StorageEndpoint string
|
||||
StorageCAFile string
|
||||
|
|
|
@ -31,9 +31,10 @@ type serverHA struct {
|
|||
}
|
||||
|
||||
func setHAData(cfg *config.Control) error {
|
||||
if cfg.StorageBackend != "etcd3" {
|
||||
if cfg.StorageBackend != "etcd3" || cfg.CertStorageBackend != "etcd3" {
|
||||
return nil
|
||||
}
|
||||
|
||||
endpoints := strings.Split(cfg.StorageEndpoint, ",")
|
||||
cli, err := clientv3.New(clientv3.Config{
|
||||
Endpoints: endpoints,
|
||||
|
@ -67,7 +68,7 @@ func setHAData(cfg *config.Control) error {
|
|||
|
||||
func getHAData(cfg *config.Control) error {
|
||||
serverRuntime := &serverHA{}
|
||||
if cfg.StorageBackend != "etcd3" {
|
||||
if cfg.StorageBackend != "etcd3" || cfg.CertStorageBackend != "etcd3" {
|
||||
return nil
|
||||
}
|
||||
endpoints := strings.Split(cfg.StorageEndpoint, ",")
|
||||
|
|
Loading…
Reference in New Issue