mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-13 11:25:19 +00:00
Avoid unnecessary map allocation
This commit is contained in:
@@ -192,13 +192,12 @@ func NodeNameTriggerFunc(obj runtime.Object) []storage.MatchValue {
|
||||
// PodToSelectableFields returns a field set that represents the object
|
||||
// TODO: fields are not labels, and the validation rules for them do not apply.
|
||||
func PodToSelectableFields(pod *api.Pod) fields.Set {
|
||||
objectMetaFieldsSet := generic.ObjectMetaFieldsSet(&pod.ObjectMeta, true)
|
||||
podSpecificFieldsSet := fields.Set{
|
||||
"spec.nodeName": pod.Spec.NodeName,
|
||||
"spec.restartPolicy": string(pod.Spec.RestartPolicy),
|
||||
"status.phase": string(pod.Status.Phase),
|
||||
}
|
||||
return generic.MergeFieldsSets(objectMetaFieldsSet, podSpecificFieldsSet)
|
||||
return generic.AddObjectMetaFieldsSet(podSpecificFieldsSet, &pod.ObjectMeta, true)
|
||||
}
|
||||
|
||||
// ResourceGetter is an interface for retrieving resources by ResourceLocation.
|
||||
|
||||
Reference in New Issue
Block a user