Merge pull request #5363 from wojtek-t/no_bound_pods_in_scheduler

Make scheduler to watch PodSpec.Host instead Status.Host
pull/6/head
Brian Grant 2015-03-12 10:57:03 -07:00
commit 19b6c85fa5
9 changed files with 12 additions and 13 deletions

View File

@ -1384,7 +1384,7 @@ func init() {
case "name": case "name":
return "name", value, nil return "name", value, nil
case "DesiredState.Host": case "DesiredState.Host":
return "status.host", value, nil return "spec.host", value, nil
case "DesiredState.Status": case "DesiredState.Status":
podStatus := PodStatus(value) podStatus := PodStatus(value)
var internalValue newer.PodPhase var internalValue newer.PodPhase

View File

@ -1300,7 +1300,7 @@ func init() {
case "name": case "name":
return "name", value, nil return "name", value, nil
case "DesiredState.Host": case "DesiredState.Host":
return "status.host", value, nil return "spec.host", value, nil
case "DesiredState.Status": case "DesiredState.Status":
podStatus := PodStatus(value) podStatus := PodStatus(value)
var internalValue newer.PodPhase var internalValue newer.PodPhase

View File

@ -31,7 +31,7 @@ func init() {
fallthrough fallthrough
case "status.phase": case "status.phase":
fallthrough fallthrough
case "status.host": case "spec.host":
return label, value, nil return label, value, nil
default: default:
return "", "", fmt.Errorf("field label not supported: %s", label) return "", "", fmt.Errorf("field label not supported: %s", label)

View File

@ -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 { 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) { return func(req *restful.Request, res *restful.Response) {
w := res.ResponseWriter 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) // 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")) timeout := parseTimeout(req.Request.URL.Query().Get("timeout"))

View File

@ -53,7 +53,7 @@ func getHostFieldLabel() string {
case "v1beta1", "v1beta2": case "v1beta1", "v1beta2":
return "DesiredState.Host" return "DesiredState.Host"
default: default:
return "status.host" return "spec.host"
} }
} }

View File

@ -57,6 +57,6 @@ func getHostFieldLabel(apiVersion string) string {
case "v1beta1", "v1beta2": case "v1beta1", "v1beta2":
return "DesiredState.Host" return "DesiredState.Host"
default: default:
return "status.host" return "spec.host"
} }
} }

View File

@ -300,7 +300,7 @@ func TestListPodListSelection(t *testing.T) {
})}, })},
{Value: runtime.EncodeOrDie(latest.Codec, &api.Pod{ {Value: runtime.EncodeOrDie(latest.Codec, &api.Pod{
ObjectMeta: api.ObjectMeta{Name: "bar"}, ObjectMeta: api.ObjectMeta{Name: "bar"},
Status: api.PodStatus{Host: "barhost"}, Spec: api.PodSpec{Host: "barhost"},
})}, })},
{Value: runtime.EncodeOrDie(latest.Codec, &api.Pod{ {Value: runtime.EncodeOrDie(latest.Codec, &api.Pod{
ObjectMeta: api.ObjectMeta{Name: "baz"}, ObjectMeta: api.ObjectMeta{Name: "baz"},
@ -341,13 +341,13 @@ func TestListPodListSelection(t *testing.T) {
field: "status.phase=Failed", field: "status.phase=Failed",
expectedIDs: util.NewStringSet("baz"), expectedIDs: util.NewStringSet("baz"),
}, { }, {
field: "status.host=barhost", field: "spec.host=barhost",
expectedIDs: util.NewStringSet("bar"), expectedIDs: util.NewStringSet("bar"),
}, { }, {
field: "status.host=", field: "spec.host=",
expectedIDs: util.NewStringSet("foo", "baz", "qux", "zot"), expectedIDs: util.NewStringSet("foo", "baz", "qux", "zot"),
}, { }, {
field: "status.host!=", field: "spec.host!=",
expectedIDs: util.NewStringSet("bar"), expectedIDs: util.NewStringSet("bar"),
}, },
} }

View File

@ -134,8 +134,8 @@ func MatchPod(label labels.Selector, field fields.Selector) generic.Matcher {
func PodToSelectableFields(pod *api.Pod) labels.Set { func PodToSelectableFields(pod *api.Pod) labels.Set {
return labels.Set{ return labels.Set{
"name": pod.Name, "name": pod.Name,
"spec.host": pod.Spec.Host,
"status.phase": string(pod.Status.Phase), "status.phase": string(pod.Status.Phase),
"status.host": pod.Status.Host,
} }
} }

View File

@ -154,7 +154,7 @@ func (f *ConfigFactory) CreateFromKeys(predicateKeys, priorityKeys util.StringSe
Binder: &binder{f.Client}, Binder: &binder{f.Client},
NextPod: func() *api.Pod { NextPod: func() *api.Pod {
pod := f.PodQueue.Pop().(*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 return pod
}, },
Error: f.makeDefaultErrorFunc(&podBackoff, f.PodQueue), Error: f.makeDefaultErrorFunc(&podBackoff, f.PodQueue),
@ -259,7 +259,7 @@ func getHostFieldLabel(apiVersion string) string {
case "v1beta1", "v1beta2": case "v1beta1", "v1beta2":
return "DesiredState.Host" return "DesiredState.Host"
default: default:
return "status.host" return "spec.host"
} }
} }