Merge pull request #1695 from ibuildthecloud/kubeproxy

Add ability to disable kubeproxy
This commit is contained in:
Erik Wilson 2020-05-04 20:26:22 -07:00 committed by GitHub
commit c941e1d0bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 2 deletions

View File

@ -474,6 +474,7 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
nodeConfig.AgentConfig.PrivateRegistry = envInfo.PrivateRegistry
nodeConfig.AgentConfig.DisableCCM = controlConfig.DisableCCM
nodeConfig.AgentConfig.DisableNPC = controlConfig.DisableNPC
nodeConfig.AgentConfig.DisableKubeProxy = controlConfig.DisableKubeProxy
nodeConfig.AgentConfig.Rootless = envInfo.Rootless
nodeConfig.DisableSELinux = envInfo.DisableSELinux

View File

@ -44,6 +44,7 @@ type Server struct {
DefaultLocalStoragePath string
DisableCCM bool
DisableNPC bool
DisableKubeProxy bool
ClusterInit bool
ClusterReset bool
EncryptSecrets bool
@ -210,6 +211,11 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
Usage: "(components) Disable k3s default cloud controller manager",
Destination: &ServerConfig.DisableCCM,
},
cli.BoolFlag{
Name: "disable-kube-proxy",
Usage: "(components) Disable running kube-proxy",
Destination: &ServerConfig.DisableKubeProxy,
},
cli.BoolFlag{
Name: "disable-network-policy",
Usage: "(components) Disable k3s default network policy controller",

View File

@ -98,6 +98,7 @@ func run(app *cli.Context, cfg *cmds.Server) error {
serverConfig.ControlConfig.ExtraCloudControllerArgs = cfg.ExtraCloudControllerArgs
serverConfig.ControlConfig.DisableCCM = cfg.DisableCCM
serverConfig.ControlConfig.DisableNPC = cfg.DisableNPC
serverConfig.ControlConfig.DisableKubeProxy = cfg.DisableKubeProxy
serverConfig.ControlConfig.ClusterInit = cfg.ClusterInit
serverConfig.ControlConfig.ClusterReset = cfg.ClusterReset
serverConfig.ControlConfig.EncryptSecrets = cfg.EncryptSecrets

View File

@ -29,12 +29,15 @@ func Agent(config *config.Agent) error {
defer logs.FlushLogs()
startKubelet(config)
startKubeProxy(config)
if !config.DisableKubeProxy {
return startKubeProxy(config)
}
return nil
}
func startKubeProxy(cfg *config.Agent) {
func startKubeProxy(cfg *config.Agent) error {
argsMap := map[string]string{
"proxy-mode": "iptables",
"healthz-bind-address": "127.0.0.1",
@ -53,6 +56,8 @@ func startKubeProxy(cfg *config.Agent) {
logrus.Infof("Running kube-proxy %s", config.ArgString(args))
logrus.Fatalf("kube-proxy exited: %v", command.Execute())
}()
return nil
}
func startKubelet(cfg *config.Agent) {

View File

@ -79,6 +79,7 @@ type Agent struct {
PrivateRegistry string
DisableCCM bool
DisableNPC bool
DisableKubeProxy bool
Rootless bool
}
@ -112,6 +113,7 @@ type Control struct {
DefaultLocalStoragePath string
DisableCCM bool
DisableNPC bool
DisableKubeProxy bool
ClusterInit bool
ClusterReset bool
EncryptSecrets bool