Commit c6b09806 authored by Wojciech Tyczynski's avatar Wojciech Tyczynski

Allocate podFields map with a correct hint for size

parent 422121f9
...@@ -192,11 +192,14 @@ func NodeNameTriggerFunc(obj runtime.Object) []storage.MatchValue { ...@@ -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)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment