Merge pull request #14820 from gmarek/playground

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2015-10-02 07:37:45 -07:00
commit 6ca515c312
4 changed files with 10 additions and 4 deletions

View File

@ -381,6 +381,7 @@ func (s *KubeletServer) KubeletConfig() (*KubeletConfig, error) {
NetworkPluginName: s.NetworkPluginName, NetworkPluginName: s.NetworkPluginName,
NetworkPlugins: ProbeNetworkPlugins(s.NetworkPluginDir), NetworkPlugins: ProbeNetworkPlugins(s.NetworkPluginDir),
NodeStatusUpdateFrequency: s.NodeStatusUpdateFrequency, NodeStatusUpdateFrequency: s.NodeStatusUpdateFrequency,
OOMAdjuster: oom.NewOOMAdjuster(),
OSInterface: kubecontainer.RealOS{}, OSInterface: kubecontainer.RealOS{},
PodCIDR: s.PodCIDR, PodCIDR: s.PodCIDR,
PodInfraContainerImage: s.PodInfraContainerImage, PodInfraContainerImage: s.PodInfraContainerImage,
@ -449,7 +450,7 @@ func (s *KubeletServer) Run(kcfg *KubeletConfig) error {
glog.V(2).Infof("Using root directory: %v", s.RootDirectory) glog.V(2).Infof("Using root directory: %v", s.RootDirectory)
// TODO(vmarmol): Do this through container config. // TODO(vmarmol): Do this through container config.
oomAdjuster := oom.NewOOMAdjuster() oomAdjuster := kcfg.OOMAdjuster
if err := oomAdjuster.ApplyOOMScoreAdj(0, s.OOMScoreAdj); err != nil { if err := oomAdjuster.ApplyOOMScoreAdj(0, s.OOMScoreAdj); err != nil {
glog.Warning(err) glog.Warning(err)
} }
@ -639,6 +640,7 @@ func SimpleKubelet(client *client.Client,
MinimumGCAge: minimumGCAge, MinimumGCAge: minimumGCAge,
Mounter: mount.New(), Mounter: mount.New(),
NodeStatusUpdateFrequency: nodeStatusUpdateFrequency, NodeStatusUpdateFrequency: nodeStatusUpdateFrequency,
OOMAdjuster: oom.NewFakeOOMAdjuster(),
OSInterface: osInterface, OSInterface: osInterface,
PodInfraContainerImage: dockertools.PodInfraContainerImage, PodInfraContainerImage: dockertools.PodInfraContainerImage,
Port: port, Port: port,
@ -819,6 +821,7 @@ type KubeletConfig struct {
NetworkPlugins []network.NetworkPlugin NetworkPlugins []network.NetworkPlugin
NodeName string NodeName string
NodeStatusUpdateFrequency time.Duration NodeStatusUpdateFrequency time.Duration
OOMAdjuster *oom.OOMAdjuster
OSInterface kubecontainer.OSInterface OSInterface kubecontainer.OSInterface
PodCIDR string PodCIDR string
PodInfraContainerImage string PodInfraContainerImage string
@ -910,7 +913,8 @@ func createAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod
kc.DockerExecHandler, kc.DockerExecHandler,
kc.ResolverConfig, kc.ResolverConfig,
kc.CPUCFSQuota, kc.CPUCFSQuota,
daemonEndpoints) daemonEndpoints,
kc.OOMAdjuster)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err

View File

@ -320,6 +320,7 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
&api.NodeDaemonEndpoints{ &api.NodeDaemonEndpoints{
KubeletEndpoint: api.DaemonEndpoint{Port: int(kc.Port)}, KubeletEndpoint: api.DaemonEndpoint{Port: int(kc.Port)},
}, },
kc.OOMAdjuster,
) )
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err

View File

@ -178,7 +178,8 @@ func NewMainKubelet(
dockerExecHandler dockertools.ExecHandler, dockerExecHandler dockertools.ExecHandler,
resolverConfig string, resolverConfig string,
cpuCFSQuota bool, cpuCFSQuota bool,
daemonEndpoints *api.NodeDaemonEndpoints) (*Kubelet, error) { daemonEndpoints *api.NodeDaemonEndpoints,
oomAdjuster *oom.OOMAdjuster) (*Kubelet, error) {
if rootDirectory == "" { if rootDirectory == "" {
return nil, fmt.Errorf("invalid root directory %q", rootDirectory) return nil, fmt.Errorf("invalid root directory %q", rootDirectory)
} }
@ -307,7 +308,6 @@ func NewMainKubelet(
return nil, err return nil, err
} }
oomAdjuster := oom.NewOOMAdjuster()
procFs := procfs.NewProcFs() procFs := procfs.NewProcFs()
// Initialize the runtime. // Initialize the runtime.

View File

@ -20,6 +20,7 @@ type FakeOOMAdjuster struct{}
func NewFakeOOMAdjuster() *OOMAdjuster { func NewFakeOOMAdjuster() *OOMAdjuster {
return &OOMAdjuster{ return &OOMAdjuster{
pidLister: func(cgroupName string) ([]int, error) { return make([]int, 0), nil },
ApplyOOMScoreAdj: fakeApplyOOMScoreAdj, ApplyOOMScoreAdj: fakeApplyOOMScoreAdj,
ApplyOOMScoreAdjContainer: fakeApplyOOMScoreAdjContainer, ApplyOOMScoreAdjContainer: fakeApplyOOMScoreAdjContainer,
} }