Change:
After I evicted an pod, I performed the operation of the full list instance, but found something that did not meet expectations After pods are evicted, non-evicted ones can be listed normally No response <details</detailsv1.20.0 <details</details<details</details<details</details<details</details<details</details
/sig node
/sig api-machinery /remove-sig node
/remove-sig api-machinery
/assign since you are tagged on the PR. Thanks! /triage accepted
/sig testing
If you have time, please help to look at this pr, thanks
this is a general issue with subresources that accept create requests of different object types than the parent resource see also:

Discussion:
<ins> /* Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package fake import ( "context" v1 "k8s.io/api/core/v1" policy "k8s.io/api/policy/v1" meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "testing" ) func TestNewSimpleClientset(t *testing.T) { client := NewSimpleClientset() client.CoreV1().Pods("default").Create(context.Background(), &v1.Pod{ ObjectMeta: meta_v1.ObjectMeta{ Name:      "pod-1", Namespace: "default", }, }, meta_v1.CreateOptions{}) client.CoreV1().Pods("default").Create(context.Background(), &v1.Pod{ ObjectMeta: meta_v1.ObjectMeta{ Name:      "pod-2", Namespace: "default", }, }, meta_v1.CreateOptions{}) err := client.CoreV1().Pods("default").EvictV1(context.Background(), &policy.Eviction{ ObjectMeta: meta_v1.ObjectMeta{ Name: "pod-2", }, }) if err != nil { t.Errorf("TestNewSimpleClientset() res = %v", err.Error()) } pods, err := client.CoreV1().Pods("default").List(context.Background(), meta_v1.ListOptions{}) // err: item[0]: can't assign or convert v1beta1.Eviction into v1.Pod if err != nil { t.Errorf("TestNewSimpleClientset() res = %v", err.Error()) } else { t.Logf("TestNewSimpleClientset() res = %v", pods) } } </ins>

if action.GetSubresource() == "" { err = tracker.Create(gvr, action.GetObject(), ns) } else { <del> // TODO: Currently we're handling subresource creation as an update // on the enclosing resource. This works for some subresources but // might not be generic enough. err = tracker.Update(gvr, action.GetObject(), ns) </del> <ins> oldObj, getOldObjErr := tracker.Get(gvr, ns, objMeta.GetName()) if getOldObjErr != nil { return true, nil, getOldObjErr } // Check whether the existing historical object type is the same as the current operation object type that needs to be updated, and if it is the same, perform the update operation. if reflect.TypeOf(oldObj) == reflect.TypeOf(action.GetObject()) { // TODO: Currently we're handling subresource creation as an update // on the enclosing resource. This works for some subresources but // might not be generic enough. err = tracker.Update(gvr, action.GetObject(), ns) } else { // If the historical object type is different from the current object type, need to make sure we return the object submitted,don't persist the submitted object in the tracker. return true, action.GetObject(), nil } </ins> } if err != nil { return true, nil, err