Make integration test pass.

pull/6/head
Daniel Smith 2014-08-21 13:35:50 -07:00
parent 29e9e13188
commit 0a1dfa366e
5 changed files with 27 additions and 6 deletions

View File

@ -38,6 +38,9 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/master"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/wait"
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler"
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/factory"
"github.com/coreos/go-etcd/etcd"
"github.com/golang/glog"
)
@ -64,7 +67,7 @@ func (fakePodInfoGetter) GetPodInfo(host, podID string) (api.PodInfo, error) {
Port: 10251,
}
default:
glog.Fatalf("Can't get info for: %v, %v", host, podID)
glog.Fatalf("Can't get info for: '%v', '%v'", host, podID)
}
return c.GetPodInfo("localhost", podID)
}
@ -106,6 +109,9 @@ func startComponents(manifestURL string) (apiServerURL string) {
storage, codec := m.API_v1beta1()
handler.delegate = apiserver.Handle(storage, codec, "/api/v1beta1")
// Scheduler
scheduler.New((&factory.ConfigFactory{cl}).Create()).Run()
controllerManager := controller.NewReplicationManager(cl)
// Prove that controllerManager's watch works by making it not sync until after this

View File

@ -135,7 +135,6 @@ func (r *Registry) setPodHostTo(podID, oldMachine, machine string) (finalPod *ap
}
// assignPod assigns the given pod to the given machine.
// TODO: hook this up via apiserver, not by calling it from CreatePod().
func (r *Registry) assignPod(podID string, machine string) error {
finalPod, err := r.setPodHostTo(podID, "", machine)
if err != nil {

View File

@ -133,10 +133,11 @@ func (rs *RegistryStorage) Watch(label, field labels.Selector, resourceVersion u
pod := e.Object.(*api.Pod)
fields := labels.Set{
"ID": pod.ID,
"DesiredState.Status": string(pod.CurrentState.Status),
"DesiredState.Host": pod.CurrentState.Host,
"DesiredState.Status": string(pod.DesiredState.Status),
"DesiredState.Host": pod.DesiredState.Host,
}
return e, label.Matches(labels.Set(pod.Labels)) && field.Matches(fields)
passesFilter := label.Matches(labels.Set(pod.Labels)) && field.Matches(fields)
return e, passesFilter
}), nil
}
@ -158,6 +159,10 @@ func (rs *RegistryStorage) Update(obj interface{}) (<-chan interface{}, error) {
}
func (rs *RegistryStorage) fillPodInfo(pod *api.Pod) {
pod.CurrentState.Host = pod.DesiredState.Host
if pod.CurrentState.Host == "" {
return
}
// Get cached info for the list currently.
// TODO: Optionally use fresh info
if rs.podCache != nil {

View File

@ -477,6 +477,7 @@ func (w *etcdWatcher) sendResult(res *etcd.Response) {
var action watch.EventType
var data []byte
var index uint64
glog.Infof("watching: got %v", res.Action)
switch res.Action {
case "create":
if res.Node == nil {

View File

@ -69,7 +69,14 @@ func (factory *ConfigFactory) Create() *scheduler.Config {
Algorithm: algo,
Binder: &binder{factory.Client},
NextPod: func() *api.Pod {
return podQueue.Pop().(*api.Pod)
pod := podQueue.Pop().(*api.Pod)
// TODO: Remove or reduce verbosity by sep 6th, 2014. Leave until then to
// make it easy to find scheduling problems.
glog.Infof("About to try and schedule pod %v\n"+
"\tknown minions: %v\n"+
"\tknown scheduled pods: %v\n",
pod.ID, minionCache.Contains(), podCache.Contains())
return pod
},
Error: factory.makeDefaultErrorFunc(podQueue),
}
@ -193,5 +200,8 @@ type binder struct {
// Bind just does a POST binding RPC.
func (b *binder) Bind(binding *api.Binding) error {
// TODO: Remove or reduce verbosity by sep 6th, 2014. Leave until then to
// make it easy to find scheduling problems.
glog.Infof("Attempting to bind %v to %v", binding.PodID, binding.Host)
return b.Post().Path("bindings").Body(binding).Do().Error()
}