Allocate podFields map with a correct hint for size
This commit is contained in:
parent
422121f93a
commit
c6b098068d
@ -192,11 +192,14 @@ func NodeNameTriggerFunc(obj runtime.Object) []storage.MatchValue {
|
|||||||
// PodToSelectableFields returns a field set that represents the object
|
// PodToSelectableFields returns a field set that represents the object
|
||||||
// TODO: fields are not labels, and the validation rules for them do not apply.
|
// TODO: fields are not labels, and the validation rules for them do not apply.
|
||||||
func PodToSelectableFields(pod *api.Pod) fields.Set {
|
func PodToSelectableFields(pod *api.Pod) fields.Set {
|
||||||
podSpecificFieldsSet := fields.Set{
|
// The purpose of allocation with a given number of elements is to reduce
|
||||||
"spec.nodeName": pod.Spec.NodeName,
|
// amount of allocations needed to create the fields.Set. If you add any
|
||||||
"spec.restartPolicy": string(pod.Spec.RestartPolicy),
|
// field here or the number of object-meta related fields changes, this should
|
||||||
"status.phase": string(pod.Status.Phase),
|
// be adjusted.
|
||||||
}
|
podSpecificFieldsSet := make(fields.Set, 5)
|
||||||
|
podSpecificFieldsSet["spec.nodeName"] = pod.Spec.NodeName
|
||||||
|
podSpecificFieldsSet["spec.restartPolicy"] = string(pod.Spec.RestartPolicy)
|
||||||
|
podSpecificFieldsSet["status.phase"] = string(pod.Status.Phase)
|
||||||
return generic.AddObjectMetaFieldsSet(podSpecificFieldsSet, &pod.ObjectMeta, true)
|
return generic.AddObjectMetaFieldsSet(podSpecificFieldsSet, &pod.ObjectMeta, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user