Skip to content

Commit

Permalink
Merge pull request kubernetes#5363 from wojtek-t/no_bound_pods_in_sch…
Browse files Browse the repository at this point in the history
…eduler

Make scheduler to watch PodSpec.Host instead Status.Host
  • Loading branch information
bgrant0607 committed Mar 12, 2015
2 parents c0b8dc5 + 9f2f10d commit 19b6c85
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/api/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ func init() {
case "name":
return "name", value, nil
case "DesiredState.Host":
return "status.host", value, nil
return "spec.host", value, nil
case "DesiredState.Status":
podStatus := PodStatus(value)
var internalValue newer.PodPhase
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1beta2/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ func init() {
case "name":
return "name", value, nil
case "DesiredState.Host":
return "status.host", value, nil
return "spec.host", value, nil
case "DesiredState.Status":
podStatus := PodStatus(value)
var internalValue newer.PodPhase
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1beta3/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func init() {
fallthrough
case "status.phase":
fallthrough
case "status.host":
case "spec.host":
return label, value, nil
default:
return "", "", fmt.Errorf("field label not supported: %s", label)
Expand Down
1 change: 0 additions & 1 deletion pkg/apiserver/resthandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ func CreateResource(r RESTCreater, ctxFn ContextFunc, namer ScopeNamer, codec ru
func PatchResource(r RESTPatcher, ctxFn ContextFunc, namer ScopeNamer, codec runtime.Codec, typer runtime.ObjectTyper, resource string, admit admission.Interface) restful.RouteFunction {
return func(req *restful.Request, res *restful.Response) {
w := res.ResponseWriter
glog.Infof("hi")

// TODO: we either want to remove timeout or document it (if we document, move timeout out of this function and declare it in api_installer)
timeout := parseTimeout(req.Request.URL.Query().Get("timeout"))
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/cache/listwatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func getHostFieldLabel() string {
case "v1beta1", "v1beta2":
return "DesiredState.Host"
default:
return "status.host"
return "spec.host"
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/config/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ func getHostFieldLabel(apiVersion string) string {
case "v1beta1", "v1beta2":
return "DesiredState.Host"
default:
return "status.host"
return "spec.host"
}
}
8 changes: 4 additions & 4 deletions pkg/registry/pod/etcd/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func TestListPodListSelection(t *testing.T) {
})},
{Value: runtime.EncodeOrDie(latest.Codec, &api.Pod{
ObjectMeta: api.ObjectMeta{Name: "bar"},
Status: api.PodStatus{Host: "barhost"},
Spec: api.PodSpec{Host: "barhost"},
})},
{Value: runtime.EncodeOrDie(latest.Codec, &api.Pod{
ObjectMeta: api.ObjectMeta{Name: "baz"},
Expand Down Expand Up @@ -341,13 +341,13 @@ func TestListPodListSelection(t *testing.T) {
field: "status.phase=Failed",
expectedIDs: util.NewStringSet("baz"),
}, {
field: "status.host=barhost",
field: "spec.host=barhost",
expectedIDs: util.NewStringSet("bar"),
}, {
field: "status.host=",
field: "spec.host=",
expectedIDs: util.NewStringSet("foo", "baz", "qux", "zot"),
}, {
field: "status.host!=",
field: "spec.host!=",
expectedIDs: util.NewStringSet("bar"),
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/registry/pod/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ func MatchPod(label labels.Selector, field fields.Selector) generic.Matcher {
func PodToSelectableFields(pod *api.Pod) labels.Set {
return labels.Set{
"name": pod.Name,
"spec.host": pod.Spec.Host,
"status.phase": string(pod.Status.Phase),
"status.host": pod.Status.Host,
}
}

Expand Down
4 changes: 2 additions & 2 deletions plugin/pkg/scheduler/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (f *ConfigFactory) CreateFromKeys(predicateKeys, priorityKeys util.StringSe
Binder: &binder{f.Client},
NextPod: func() *api.Pod {
pod := f.PodQueue.Pop().(*api.Pod)
glog.V(2).Infof("glog.v2 --> About to try and schedule pod %v", pod.Name)
glog.V(2).Infof("About to try and schedule pod %v", pod.Name)
return pod
},
Error: f.makeDefaultErrorFunc(&podBackoff, f.PodQueue),
Expand Down Expand Up @@ -259,7 +259,7 @@ func getHostFieldLabel(apiVersion string) string {
case "v1beta1", "v1beta2":
return "DesiredState.Host"
default:
return "status.host"
return "spec.host"
}
}

Expand Down

0 comments on commit 19b6c85

Please sign in to comment.