Commit a15e7e8b authored by Brad Davidson's avatar Brad Davidson Committed by Brad Davidson

Move DisableServiceLB/Rootless/ServiceLBNamespace into config.Control

parent 06303947
...@@ -114,8 +114,8 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont ...@@ -114,8 +114,8 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
serverConfig.ControlConfig.DataDir = cfg.DataDir serverConfig.ControlConfig.DataDir = cfg.DataDir
serverConfig.ControlConfig.KubeConfigOutput = cfg.KubeConfigOutput serverConfig.ControlConfig.KubeConfigOutput = cfg.KubeConfigOutput
serverConfig.ControlConfig.KubeConfigMode = cfg.KubeConfigMode serverConfig.ControlConfig.KubeConfigMode = cfg.KubeConfigMode
serverConfig.Rootless = cfg.Rootless serverConfig.ControlConfig.Rootless = cfg.Rootless
serverConfig.ServiceLBNamespace = cfg.ServiceLBNamespace serverConfig.ControlConfig.ServiceLBNamespace = cfg.ServiceLBNamespace
serverConfig.ControlConfig.SANs = cfg.TLSSan serverConfig.ControlConfig.SANs = cfg.TLSSan
serverConfig.ControlConfig.BindAddress = cfg.BindAddress serverConfig.ControlConfig.BindAddress = cfg.BindAddress
serverConfig.ControlConfig.SupervisorPort = cfg.SupervisorPort serverConfig.ControlConfig.SupervisorPort = cfg.SupervisorPort
...@@ -359,7 +359,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont ...@@ -359,7 +359,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
} }
} }
if serverConfig.ControlConfig.Skips["servicelb"] { if serverConfig.ControlConfig.Skips["servicelb"] {
serverConfig.DisableServiceLB = true serverConfig.ControlConfig.DisableServiceLB = true
} }
if serverConfig.ControlConfig.DisableCCM { if serverConfig.ControlConfig.DisableCCM {
...@@ -479,7 +479,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont ...@@ -479,7 +479,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
agentConfig.ServerURL = url agentConfig.ServerURL = url
agentConfig.Token = token agentConfig.Token = token
agentConfig.DisableLoadBalancer = !serverConfig.ControlConfig.DisableAPIServer agentConfig.DisableLoadBalancer = !serverConfig.ControlConfig.DisableAPIServer
agentConfig.DisableServiceLB = serverConfig.DisableServiceLB agentConfig.DisableServiceLB = serverConfig.ControlConfig.DisableServiceLB
agentConfig.ETCDAgent = serverConfig.ControlConfig.DisableAPIServer agentConfig.ETCDAgent = serverConfig.ControlConfig.DisableAPIServer
agentConfig.ClusterReset = serverConfig.ControlConfig.ClusterReset agentConfig.ClusterReset = serverConfig.ControlConfig.ClusterReset
agentConfig.Rootless = cfg.Rootless agentConfig.Rootless = cfg.Rootless
......
...@@ -175,6 +175,9 @@ type Control struct { ...@@ -175,6 +175,9 @@ type Control struct {
DisableETCD bool DisableETCD bool
DisableKubeProxy bool DisableKubeProxy bool
DisableScheduler bool DisableScheduler bool
DisableServiceLB bool
Rootless bool
ServiceLBNamespace string
EnablePProf bool EnablePProf bool
ExtraAPIArgs []string ExtraAPIArgs []string
ExtraControllerArgs []string ExtraControllerArgs []string
......
...@@ -436,7 +436,7 @@ func passwordBootstrap(ctx context.Context, config *Config) nodePassBootstrapper ...@@ -436,7 +436,7 @@ func passwordBootstrap(ctx context.Context, config *Config) nodePassBootstrapper
func verifyLocalPassword(ctx context.Context, config *Config, mu *sync.Mutex, deferredNodes map[string]bool, nodeName, nodePassword string) (string, int, error) { func verifyLocalPassword(ctx context.Context, config *Config, mu *sync.Mutex, deferredNodes map[string]bool, nodeName, nodePassword string) (string, int, error) {
// use same password file location that the agent creates // use same password file location that the agent creates
nodePasswordRoot := "/" nodePasswordRoot := "/"
if config.Rootless { if config.ControlConfig.Rootless {
nodePasswordRoot = filepath.Join(config.ControlConfig.DataDir, "agent") nodePasswordRoot = filepath.Join(config.ControlConfig.DataDir, "agent")
} }
nodeConfigPath := filepath.Join(nodePasswordRoot, "etc", "rancher", "node") nodeConfigPath := filepath.Join(nodePasswordRoot, "etc", "rancher", "node")
......
...@@ -214,9 +214,9 @@ func coreControllers(ctx context.Context, sc *Context, config *Config) error { ...@@ -214,9 +214,9 @@ func coreControllers(ctx context.Context, sc *Context, config *Config) error {
sc.Core.Core().V1().Pod(), sc.Core.Core().V1().Pod(),
sc.Core.Core().V1().Service(), sc.Core.Core().V1().Service(),
sc.Core.Core().V1().Endpoints(), sc.Core.Core().V1().Endpoints(),
config.ServiceLBNamespace, config.ControlConfig.ServiceLBNamespace,
!config.DisableServiceLB, !config.ControlConfig.DisableServiceLB,
config.Rootless); err != nil { config.ControlConfig.Rootless); err != nil {
return err return err
} }
...@@ -230,10 +230,10 @@ func coreControllers(ctx context.Context, sc *Context, config *Config) error { ...@@ -230,10 +230,10 @@ func coreControllers(ctx context.Context, sc *Context, config *Config) error {
} }
} }
if config.Rootless { if config.ControlConfig.Rootless {
return rootlessports.Register(ctx, return rootlessports.Register(ctx,
sc.Core.Core().V1().Service(), sc.Core.Core().V1().Service(),
!config.DisableServiceLB, !config.ControlConfig.DisableServiceLB,
config.ControlConfig.HTTPSPort) config.ControlConfig.HTTPSPort)
} }
...@@ -378,7 +378,7 @@ func writeKubeConfig(certs string, config *Config) error { ...@@ -378,7 +378,7 @@ func writeKubeConfig(certs string, config *Config) error {
port = config.ControlConfig.APIServerPort port = config.ControlConfig.APIServerPort
} }
url := fmt.Sprintf("https://%s:%d", ip, port) url := fmt.Sprintf("https://%s:%d", ip, port)
kubeConfig, err := HomeKubeConfig(true, config.Rootless) kubeConfig, err := HomeKubeConfig(true, config.ControlConfig.Rootless)
def := true def := true
if err != nil { if err != nil {
kubeConfig = filepath.Join(config.ControlConfig.DataDir, "kubeconfig-"+version.Program+".yaml") kubeConfig = filepath.Join(config.ControlConfig.DataDir, "kubeconfig-"+version.Program+".yaml")
......
...@@ -8,15 +8,12 @@ import ( ...@@ -8,15 +8,12 @@ import (
) )
type Config struct { type Config struct {
DisableAgent bool DisableAgent bool
DisableServiceLB bool ControlConfig config.Control
ControlConfig config.Control SupervisorPort int
Rootless bool StartupHooks []cmds.StartupHook
ServiceLBNamespace string LeaderControllers CustomControllers
SupervisorPort int Controllers CustomControllers
StartupHooks []cmds.StartupHook
LeaderControllers CustomControllers
Controllers CustomControllers
} }
type CustomControllers []func(ctx context.Context, sc *Context) error type CustomControllers []func(ctx context.Context, sc *Context) error
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment