Revert "Adding converter functions to convert field label selectors to internal version before matching"

This commit is contained in:
Zach Loafman
2015-02-28 11:42:49 -08:00
parent 0fec31a11e
commit 5f35a67002
13 changed files with 56 additions and 224 deletions

View File

@@ -143,7 +143,7 @@ func (f *ConfigFactory) CreateFromKeys(predicateKeys, priorityKeys util.StringSe
// createUnassignedPodLW returns a cache.ListWatch that finds all pods that need to be
// scheduled.
func (factory *ConfigFactory) createUnassignedPodLW() *cache.ListWatch {
return cache.NewListWatchFromClient(factory.Client, "pods", api.NamespaceAll, labels.Set{getHostFieldLabel(factory.Client.APIVersion()): ""}.AsSelector())
return cache.NewListWatchFromClient(factory.Client, "pods", api.NamespaceAll, labels.Set{"DesiredState.Host": ""}.AsSelector())
}
func parseSelectorOrDie(s string) labels.Selector {
@@ -158,8 +158,7 @@ func parseSelectorOrDie(s string) labels.Selector {
// already scheduled.
// TODO: return a ListerWatcher interface instead?
func (factory *ConfigFactory) createAssignedPodLW() *cache.ListWatch {
return cache.NewListWatchFromClient(factory.Client, "pods", api.NamespaceAll,
parseSelectorOrDie(getHostFieldLabel(factory.Client.APIVersion())+"!="))
return cache.NewListWatchFromClient(factory.Client, "pods", api.NamespaceAll, parseSelectorOrDie("DesiredState.Host!="))
}
// createMinionLW returns a cache.ListWatch that gets all changes to minions.
@@ -232,15 +231,6 @@ func (factory *ConfigFactory) makeDefaultErrorFunc(backoff *podBackoff, podQueue
}
}
func getHostFieldLabel(apiVersion string) string {
switch apiVersion {
case "v1beta1", "v1beta2":
return "DesiredState.Host"
default:
return "Status.Host"
}
}
// nodeEnumerator allows a cache.Poller to enumerate items in an api.NodeList
type nodeEnumerator struct {
*api.NodeList