mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 11:18:16 +00:00
move job to generalized label selector
This commit is contained in:
@@ -43,7 +43,9 @@ func newJob(parallelism, completions int) *extensions.Job {
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: ¶llelism,
|
||||
Completions: &completions,
|
||||
Selector: map[string]string{"foo": "bar"},
|
||||
Selector: &extensions.PodSelector{
|
||||
MatchLabels: map[string]string{"foo": "bar"},
|
||||
},
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
@@ -76,7 +78,7 @@ func newPodList(count int, status api.PodPhase, job *extensions.Job) []api.Pod {
|
||||
newPod := api.Pod{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: fmt.Sprintf("pod-%v", unversioned.Now().UnixNano()),
|
||||
Labels: job.Spec.Selector,
|
||||
Labels: job.Spec.Selector.MatchLabels,
|
||||
Namespace: job.Namespace,
|
||||
},
|
||||
Status: api.PodStatus{Phase: status},
|
||||
@@ -289,7 +291,9 @@ func TestJobPodLookup(t *testing.T) {
|
||||
job: &extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{Name: "foo"},
|
||||
Spec: extensions.JobSpec{
|
||||
Selector: map[string]string{"foo": "bar"},
|
||||
Selector: &extensions.PodSelector{
|
||||
MatchLabels: map[string]string{"foo": "bar"},
|
||||
},
|
||||
},
|
||||
},
|
||||
pod: &api.Pod{
|
||||
@@ -306,7 +310,15 @@ func TestJobPodLookup(t *testing.T) {
|
||||
job: &extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{Name: "bar", Namespace: "ns"},
|
||||
Spec: extensions.JobSpec{
|
||||
Selector: map[string]string{"foo": "bar"},
|
||||
Selector: &extensions.PodSelector{
|
||||
MatchExpressions: []extensions.PodSelectorRequirement{
|
||||
{
|
||||
Key: "foo",
|
||||
Operator: extensions.PodSelectorOpIn,
|
||||
Values: []string{"bar"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
pod: &api.Pod{
|
||||
|
||||
Reference in New Issue
Block a user