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

This reverts commit 5f35a67002.
This commit is contained in:
Daniel Smith
2015-03-02 15:00:09 -08:00
parent 32523f8a52
commit c4822dc060
13 changed files with 225 additions and 57 deletions

View File

@@ -23,7 +23,6 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/rest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/validation"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic"
@@ -120,18 +119,10 @@ func MatchPod(label, field labels.Selector) generic.Matcher {
// PodToSelectableFields returns a label set that represents the object
// TODO: fields are not labels, and the validation rules for them do not apply.
func PodToSelectableFields(pod *api.Pod) labels.Set {
// TODO we are populating both Status and DesiredState because selectors are not aware of API versions
// see https://github.com/GoogleCloudPlatform/kubernetes/pull/2503
var olderPodStatus v1beta1.PodStatus
api.Scheme.Convert(pod.Status.Phase, &olderPodStatus)
return labels.Set{
"name": pod.Name,
"Status.Phase": string(pod.Status.Phase),
"Status.Host": pod.Status.Host,
"DesiredState.Status": string(olderPodStatus),
"DesiredState.Host": pod.Status.Host,
"name": pod.Name,
"Status.Phase": string(pod.Status.Phase),
"Status.Host": pod.Status.Host,
}
}