Move DisableServiceLB/Rootless/ServiceLBNamespace into config.Control

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2022-09-29 20:16:33 +00:00 committed by Brad Davidson
parent 063039471c
commit a15e7e8b68
5 changed files with 20 additions and 20 deletions

View File

@ -114,8 +114,8 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
serverConfig.ControlConfig.DataDir = cfg.DataDir
serverConfig.ControlConfig.KubeConfigOutput = cfg.KubeConfigOutput
serverConfig.ControlConfig.KubeConfigMode = cfg.KubeConfigMode
serverConfig.Rootless = cfg.Rootless
serverConfig.ServiceLBNamespace = cfg.ServiceLBNamespace
serverConfig.ControlConfig.Rootless = cfg.Rootless
serverConfig.ControlConfig.ServiceLBNamespace = cfg.ServiceLBNamespace
serverConfig.ControlConfig.SANs = cfg.TLSSan
serverConfig.ControlConfig.BindAddress = cfg.BindAddress
serverConfig.ControlConfig.SupervisorPort = cfg.SupervisorPort
@ -359,7 +359,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
}
}
if serverConfig.ControlConfig.Skips["servicelb"] {
serverConfig.DisableServiceLB = true
serverConfig.ControlConfig.DisableServiceLB = true
}
if serverConfig.ControlConfig.DisableCCM {
@ -479,7 +479,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
agentConfig.ServerURL = url
agentConfig.Token = token
agentConfig.DisableLoadBalancer = !serverConfig.ControlConfig.DisableAPIServer
agentConfig.DisableServiceLB = serverConfig.DisableServiceLB
agentConfig.DisableServiceLB = serverConfig.ControlConfig.DisableServiceLB
agentConfig.ETCDAgent = serverConfig.ControlConfig.DisableAPIServer
agentConfig.ClusterReset = serverConfig.ControlConfig.ClusterReset
agentConfig.Rootless = cfg.Rootless

View File

@ -175,6 +175,9 @@ type Control struct {
DisableETCD bool
DisableKubeProxy bool
DisableScheduler bool
DisableServiceLB bool
Rootless bool
ServiceLBNamespace string
EnablePProf bool
ExtraAPIArgs []string
ExtraControllerArgs []string

View File

@ -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) {
// use same password file location that the agent creates
nodePasswordRoot := "/"
if config.Rootless {
if config.ControlConfig.Rootless {
nodePasswordRoot = filepath.Join(config.ControlConfig.DataDir, "agent")
}
nodeConfigPath := filepath.Join(nodePasswordRoot, "etc", "rancher", "node")

View File

@ -214,9 +214,9 @@ func coreControllers(ctx context.Context, sc *Context, config *Config) error {
sc.Core.Core().V1().Pod(),
sc.Core.Core().V1().Service(),
sc.Core.Core().V1().Endpoints(),
config.ServiceLBNamespace,
!config.DisableServiceLB,
config.Rootless); err != nil {
config.ControlConfig.ServiceLBNamespace,
!config.ControlConfig.DisableServiceLB,
config.ControlConfig.Rootless); err != nil {
return err
}
@ -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,
sc.Core.Core().V1().Service(),
!config.DisableServiceLB,
!config.ControlConfig.DisableServiceLB,
config.ControlConfig.HTTPSPort)
}
@ -378,7 +378,7 @@ func writeKubeConfig(certs string, config *Config) error {
port = config.ControlConfig.APIServerPort
}
url := fmt.Sprintf("https://%s:%d", ip, port)
kubeConfig, err := HomeKubeConfig(true, config.Rootless)
kubeConfig, err := HomeKubeConfig(true, config.ControlConfig.Rootless)
def := true
if err != nil {
kubeConfig = filepath.Join(config.ControlConfig.DataDir, "kubeconfig-"+version.Program+".yaml")

View File

@ -8,15 +8,12 @@ import (
)
type Config struct {
DisableAgent bool
DisableServiceLB bool
ControlConfig config.Control
Rootless bool
ServiceLBNamespace string
SupervisorPort int
StartupHooks []cmds.StartupHook
LeaderControllers CustomControllers
Controllers CustomControllers
DisableAgent bool
ControlConfig config.Control
SupervisorPort int
StartupHooks []cmds.StartupHook
LeaderControllers CustomControllers
Controllers CustomControllers
}
type CustomControllers []func(ctx context.Context, sc *Context) error