Add cert storage backend flag

pull/562/head
galal-hussein 2019-06-28 20:47:21 +02:00
parent 28d9d83be2
commit 37582b6fac
4 changed files with 11 additions and 2 deletions

View File

@ -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",

View File

@ -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

View File

@ -81,6 +81,7 @@ type Control struct {
KubeConfigMode string
DataDir string
Skips []string
CertStorageBackend string
StorageBackend string
StorageEndpoint string
StorageCAFile string

View File

@ -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, ",")