Move extensions.LabelSelector to unversioned.

Move type LabelSelector and type LabelSelectorRequirement from pkg/apis/extensions
This avoids an import loop when Job (and later DaemonSet, Deployment, ReplicaSet)
are moved out of extensions to new api groups.

Also Move LabelSelectorAsSelector utility from pkg/apis/extensions/ to pkg/api/unversioned/
Also its test.
Also LabelSelectorOp* constants.
Also the pkg/apis/extensions/validation functions ValidateLabelSelectorRequirement and
ValidateLabelSelector move to pkg/api/unversioned

The related type in pkg/apis/extensions/v1beta1/ is staying there.  I might move
it in another PR if neccessary.
This commit is contained in:
Eric Tune
2016-02-01 21:34:42 -08:00
parent ad9fa30e7e
commit 6133cb1f21
29 changed files with 316 additions and 246 deletions

View File

@@ -24,6 +24,7 @@ import (
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/client/cache"
@@ -365,7 +366,7 @@ func (dsc *DaemonSetsController) updateNode(old, cur interface{}) {
// getNodesToDaemonSetPods returns a map from nodes to daemon pods (corresponding to ds) running on the nodes.
func (dsc *DaemonSetsController) getNodesToDaemonPods(ds *extensions.DaemonSet) (map[string][]*api.Pod, error) {
nodeToDaemonPods := make(map[string][]*api.Pod)
selector, err := extensions.LabelSelectorAsSelector(ds.Spec.Selector)
selector, err := unversioned.LabelSelectorAsSelector(ds.Spec.Selector)
if err != nil {
return nil, err
}