Move container manager into a separate package.

Inject container manager into Kubelet. This lets us stub out container
manager during integration testing.
This commit is contained in:
Vishnu kannan
2015-10-09 17:09:53 -07:00
parent 129dbc734c
commit 4ad3d6f5fe
16 changed files with 159 additions and 69 deletions

View File

@@ -19,26 +19,12 @@ package kubelet
import (
"fmt"
cadvisorapi "github.com/google/cadvisor/info/v1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/capabilities"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/securitycontext"
)
func CapacityFromMachineInfo(info *cadvisorapi.MachineInfo) api.ResourceList {
c := api.ResourceList{
api.ResourceCPU: *resource.NewMilliQuantity(
int64(info.NumCores*1000),
resource.DecimalSI),
api.ResourceMemory: *resource.NewQuantity(
info.MemoryCapacity,
resource.BinarySI),
}
return c
}
// Check whether we have the capabilities to run the specified pod.
func canRunPod(pod *api.Pod) error {
if pod.Spec.SecurityContext != nil && pod.Spec.SecurityContext.HostNetwork {