mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Add --path-override to minion to change the PATH env var of subprocesses;
pass hostname-override through to kube-proxy (if defined)
This commit is contained in:
parent
c9a8b2a405
commit
cac58f6db7
@ -22,6 +22,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
exservice "k8s.io/kubernetes/contrib/mesos/pkg/executor/service"
|
exservice "k8s.io/kubernetes/contrib/mesos/pkg/executor/service"
|
||||||
@ -49,6 +50,8 @@ type MinionServer struct {
|
|||||||
done chan struct{} // closed when shutting down
|
done chan struct{} // closed when shutting down
|
||||||
exit chan error // to signal fatal errors
|
exit chan error // to signal fatal errors
|
||||||
|
|
||||||
|
pathOverride string // the PATH environment for the sub-processes
|
||||||
|
|
||||||
logMaxSize resource.Quantity
|
logMaxSize resource.Quantity
|
||||||
logMaxBackups int
|
logMaxBackups int
|
||||||
logMaxAgeInDays int
|
logMaxAgeInDays int
|
||||||
@ -113,6 +116,9 @@ func (ms *MinionServer) launchProxyServer() {
|
|||||||
if ms.clientConfig.Host != "" {
|
if ms.clientConfig.Host != "" {
|
||||||
args = append(args, fmt.Sprintf("--master=%s", ms.clientConfig.Host))
|
args = append(args, fmt.Sprintf("--master=%s", ms.clientConfig.Host))
|
||||||
}
|
}
|
||||||
|
if ms.KubeletExecutorServer.HostnameOverride != "" {
|
||||||
|
args = append(args, fmt.Sprintf("--hostname-override=%s", ms.KubeletExecutorServer.HostnameOverride))
|
||||||
|
}
|
||||||
|
|
||||||
ms.launchHyperkubeServer(hyperkube.CommandProxy, &args, "proxy.log")
|
ms.launchHyperkubeServer(hyperkube.CommandProxy, &args, "proxy.log")
|
||||||
}
|
}
|
||||||
@ -204,6 +210,18 @@ func (ms *MinionServer) launchHyperkubeServer(server string, args *[]string, log
|
|||||||
log.Infof("wrote %d bytes to %v", written, logFileName)
|
log.Infof("wrote %d bytes to %v", written, logFileName)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// use given environment, but add /usr/sbin to the path for the iptables binary used in kube-proxy
|
||||||
|
if ms.pathOverride != "" {
|
||||||
|
env := os.Environ()
|
||||||
|
cmd.Env = make([]string, 0, len(env))
|
||||||
|
for _, e := range env {
|
||||||
|
if !strings.HasPrefix(e, "PATH=") {
|
||||||
|
cmd.Env = append(cmd.Env, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cmd.Env = append(cmd.Env, "PATH="+ms.pathOverride)
|
||||||
|
}
|
||||||
|
|
||||||
// if the server fails to start then we exit the executor, otherwise
|
// if the server fails to start then we exit the executor, otherwise
|
||||||
// wait for the proxy process to end (and release resources after).
|
// wait for the proxy process to end (and release resources after).
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
@ -258,6 +276,7 @@ func (ms *MinionServer) AddExecutorFlags(fs *pflag.FlagSet) {
|
|||||||
func (ms *MinionServer) AddMinionFlags(fs *pflag.FlagSet) {
|
func (ms *MinionServer) AddMinionFlags(fs *pflag.FlagSet) {
|
||||||
// general minion flags
|
// general minion flags
|
||||||
fs.BoolVar(&ms.privateMountNS, "private-mountns", ms.privateMountNS, "Enter a private mount NS before spawning procs (linux only). Experimental, not yet compatible with k8s volumes.")
|
fs.BoolVar(&ms.privateMountNS, "private-mountns", ms.privateMountNS, "Enter a private mount NS before spawning procs (linux only). Experimental, not yet compatible with k8s volumes.")
|
||||||
|
fs.StringVar(&ms.pathOverride, "path-override", ms.pathOverride, "Override the PATH in the environment of the sub-processes.")
|
||||||
|
|
||||||
// log file flags
|
// log file flags
|
||||||
fs.Var(resource.NewQuantityFlagValue(&ms.logMaxSize), "max-log-size", "Maximum log file size for the executor and proxy before rotation")
|
fs.Var(resource.NewQuantityFlagValue(&ms.logMaxSize), "max-log-size", "Maximum log file size for the executor and proxy before rotation")
|
||||||
|
@ -107,6 +107,7 @@ type SchedulerServer struct {
|
|||||||
ProxyBindall bool
|
ProxyBindall bool
|
||||||
ProxyLogV int
|
ProxyLogV int
|
||||||
|
|
||||||
|
MinionPathOverride string
|
||||||
MinionLogMaxSize resource.Quantity
|
MinionLogMaxSize resource.Quantity
|
||||||
MinionLogMaxBackups int
|
MinionLogMaxBackups int
|
||||||
MinionLogMaxAgeInDays int
|
MinionLogMaxAgeInDays int
|
||||||
@ -237,6 +238,7 @@ func (s *SchedulerServer) addCoreFlags(fs *pflag.FlagSet) {
|
|||||||
fs.BoolVar(&s.RunProxy, "run-proxy", s.RunProxy, "Run the kube-proxy as a side process of the executor.")
|
fs.BoolVar(&s.RunProxy, "run-proxy", s.RunProxy, "Run the kube-proxy as a side process of the executor.")
|
||||||
fs.IntVar(&s.ProxyLogV, "proxy-logv", s.ProxyLogV, "Logging verbosity of spawned minion proxy processes.")
|
fs.IntVar(&s.ProxyLogV, "proxy-logv", s.ProxyLogV, "Logging verbosity of spawned minion proxy processes.")
|
||||||
|
|
||||||
|
fs.StringVar(&s.MinionPathOverride, "minion-path-override", s.MinionPathOverride, "Override the PATH in the environment of the minion sub-processes.")
|
||||||
fs.Var(resource.NewQuantityFlagValue(&s.MinionLogMaxSize), "minion-max-log-size", "Maximum log file size for the executor and proxy before rotation")
|
fs.Var(resource.NewQuantityFlagValue(&s.MinionLogMaxSize), "minion-max-log-size", "Maximum log file size for the executor and proxy before rotation")
|
||||||
fs.IntVar(&s.MinionLogMaxAgeInDays, "minion-max-log-age", s.MinionLogMaxAgeInDays, "Maximum log file age of the executor and proxy in days")
|
fs.IntVar(&s.MinionLogMaxAgeInDays, "minion-max-log-age", s.MinionLogMaxAgeInDays, "Maximum log file age of the executor and proxy in days")
|
||||||
fs.IntVar(&s.MinionLogMaxBackups, "minion-max-log-backups", s.MinionLogMaxBackups, "Maximum log file backups of the executor and proxy to keep after rotation")
|
fs.IntVar(&s.MinionLogMaxBackups, "minion-max-log-backups", s.MinionLogMaxBackups, "Maximum log file backups of the executor and proxy to keep after rotation")
|
||||||
@ -327,6 +329,7 @@ func (s *SchedulerServer) prepareExecutorInfo(hks hyperkube.Interface) (*mesos.E
|
|||||||
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--proxy-bindall=%v", s.ProxyBindall))
|
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--proxy-bindall=%v", s.ProxyBindall))
|
||||||
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--proxy-logv=%d", s.ProxyLogV))
|
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--proxy-logv=%d", s.ProxyLogV))
|
||||||
|
|
||||||
|
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--path-override=%s", s.MinionPathOverride))
|
||||||
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--max-log-size=%v", s.MinionLogMaxSize.String()))
|
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--max-log-size=%v", s.MinionLogMaxSize.String()))
|
||||||
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--max-log-backups=%d", s.MinionLogMaxBackups))
|
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--max-log-backups=%d", s.MinionLogMaxBackups))
|
||||||
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--max-log-age=%d", s.MinionLogMaxAgeInDays))
|
ci.Arguments = append(ci.Arguments, fmt.Sprintf("--max-log-age=%d", s.MinionLogMaxAgeInDays))
|
||||||
|
@ -156,6 +156,7 @@ minimum-container-ttl-duration
|
|||||||
minion-max-log-age
|
minion-max-log-age
|
||||||
minion-max-log-backups
|
minion-max-log-backups
|
||||||
minion-max-log-size
|
minion-max-log-size
|
||||||
|
minion-path-override
|
||||||
min-pr-number
|
min-pr-number
|
||||||
min-request-timeout
|
min-request-timeout
|
||||||
namespace-sync-period
|
namespace-sync-period
|
||||||
@ -176,6 +177,7 @@ oidc-username-claim
|
|||||||
oom-score-adj
|
oom-score-adj
|
||||||
output-version
|
output-version
|
||||||
out-version
|
out-version
|
||||||
|
path-override
|
||||||
pod-cidr
|
pod-cidr
|
||||||
pod-eviction-timeout
|
pod-eviction-timeout
|
||||||
pod-infra-container-image
|
pod-infra-container-image
|
||||||
|
Loading…
Reference in New Issue
Block a user