kubeedge / kubeedge

Kubernetes Native Edge Computing Framework (project under CNCF)
https://kubeedge.io
Apache License 2.0
6.68k stars 1.71k forks source link

Get a DeviceList through the API provided by MetaServer on the edge. The Kind field in the return information is incorrect. #5890

Open dcdc831 opened 3 hours ago

dcdc831 commented 3 hours ago

What happened:

When I get *v1beta1.DeviceList using the clientSet provided by kubeedge:

    deviceList, err := versionedClient.DevicesV1beta1().Devices(deviceRequest.Namespace).List(ctx, metaV1.ListOptions{
        LabelSelector: deviceRequest.LabelSelector,
    })
    if err != nil {
        return nil, fmt.Errorf("failed to list devices: %v", err)
    }

an error occurs: error

Then I call MetaServer API directly:

curl 'http://127.0.0.1:10550/apis/devices.kubeedge.io/v1beta1/namespaces/default/devices'

The Kind field in the return information is DevicList : image

What you expected to happen:

The Kind field in the return information is DeviceList.

Anything else we need to know?:

This bug might be related to suffix handling.

Environment:

wbc6080 commented 2 hours ago

This problem is similar to #4471 . It is caused by the inaccuracy of the singular and plural conversion of English words when metaserver parses resource types, such as changing devices to devic, or changing namespaces to namespac.

image

/assign