mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
add fieldSelector podIP
This commit is contained in:
parent
7bc1c67685
commit
c6cafa576c
@ -200,6 +200,7 @@ func PodToSelectableFields(pod *api.Pod) fields.Set {
|
||||
podSpecificFieldsSet["spec.nodeName"] = pod.Spec.NodeName
|
||||
podSpecificFieldsSet["spec.restartPolicy"] = string(pod.Spec.RestartPolicy)
|
||||
podSpecificFieldsSet["status.phase"] = string(pod.Status.Phase)
|
||||
podSpecificFieldsSet["status.podIP"] = string(pod.Status.PodIP)
|
||||
return generic.AddObjectMetaFieldsSet(podSpecificFieldsSet, &pod.ObjectMeta, true)
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,20 @@ func TestMatchPod(t *testing.T) {
|
||||
fieldSelector: fields.ParseSelectorOrDie("status.phase=Pending"),
|
||||
expectMatch: false,
|
||||
},
|
||||
{
|
||||
in: &api.Pod{
|
||||
Status: api.PodStatus{PodIP: "1.2.3.4"},
|
||||
},
|
||||
fieldSelector: fields.ParseSelectorOrDie("status.podIP=1.2.3.4"),
|
||||
expectMatch: true,
|
||||
},
|
||||
{
|
||||
in: &api.Pod{
|
||||
Status: api.PodStatus{PodIP: "1.2.3.4"},
|
||||
},
|
||||
fieldSelector: fields.ParseSelectorOrDie("status.podIP=4.3.2.1"),
|
||||
expectMatch: false,
|
||||
},
|
||||
}
|
||||
for _, testCase := range testCases {
|
||||
m := MatchPod(labels.Everything(), testCase.fieldSelector)
|
||||
|
Loading…
Reference in New Issue
Block a user