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

@@ -66,7 +66,7 @@ func newReplicaSet(replicas int, selectorMap map[string]string) *extensions.Repl
},
Spec: extensions.ReplicaSetSpec{
Replicas: replicas,
Selector: &extensions.LabelSelector{MatchLabels: selectorMap},
Selector: &unversioned.LabelSelector{MatchLabels: selectorMap},
Template: &api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{
Labels: map[string]string{
@@ -379,7 +379,7 @@ func TestPodControllerLookup(t *testing.T) {
{
ObjectMeta: api.ObjectMeta{Name: "foo"},
Spec: extensions.ReplicaSetSpec{
Selector: &extensions.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
},
},
},
@@ -394,7 +394,7 @@ func TestPodControllerLookup(t *testing.T) {
{
ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"},
Spec: extensions.ReplicaSetSpec{
Selector: &extensions.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
},
},
},
@@ -537,7 +537,7 @@ func TestUpdatePods(t *testing.T) {
manager.rsStore.Store.Add(testRSSpec1)
testRSSpec2 := *testRSSpec1
labelMap2 := map[string]string{"bar": "foo"}
testRSSpec2.Spec.Selector = &extensions.LabelSelector{MatchLabels: labelMap2}
testRSSpec2.Spec.Selector = &unversioned.LabelSelector{MatchLabels: labelMap2}
testRSSpec2.Name = "barfoo"
manager.rsStore.Store.Add(&testRSSpec2)