Merge pull request #5363 from wojtek-t/no_bound_pods_in_scheduler
Make scheduler to watch PodSpec.Host instead Status.Host
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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"))
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								pkg/client/cache/listwatch_test.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								pkg/client/cache/listwatch_test.go
									
									
									
									
										vendored
									
									
								
							@@ -53,7 +53,7 @@ func getHostFieldLabel() string {
 | 
			
		||||
	case "v1beta1", "v1beta2":
 | 
			
		||||
		return "DesiredState.Host"
 | 
			
		||||
	default:
 | 
			
		||||
		return "status.host"
 | 
			
		||||
		return "spec.host"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -57,6 +57,6 @@ func getHostFieldLabel(apiVersion string) string {
 | 
			
		||||
	case "v1beta1", "v1beta2":
 | 
			
		||||
		return "DesiredState.Host"
 | 
			
		||||
	default:
 | 
			
		||||
		return "status.host"
 | 
			
		||||
		return "spec.host"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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"},
 | 
			
		||||
@@ -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"),
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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),
 | 
			
		||||
@@ -259,7 +259,7 @@ func getHostFieldLabel(apiVersion string) string {
 | 
			
		||||
	case "v1beta1", "v1beta2":
 | 
			
		||||
		return "DesiredState.Host"
 | 
			
		||||
	default:
 | 
			
		||||
		return "status.host"
 | 
			
		||||
		return "spec.host"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user