Skip to content

'Event' cannot filterby anything #10083

Open
@lex1ng

Description

@lex1ng

What happened?

When I curl /api/v1/event/default?filterBy=name,computenode2-xxxxxx. I notice that there is no filtering or selection applied. I can still see events with names starting with computenode1-xxxx

Image

And I checked the code and found out there is indeed no filtering action when selecting the events.

https://github.com/kubernetes/dashboard/blob/2e89a34cbdc951e989318b5b26826a4a195e8e53/modules/api/pkg/resource/event/common.go#L234C2-L240C2

func CreateEventList(events []v1.Event, dsQuery *dataselect.DataSelectQuery) common.EventList {
	eventList := common.EventList{
		Events:   make([]common.Event, 0),
		ListMeta: types.ListMeta{TotalItems: len(events)},
	}

	events = fromCells(dataselect.GenericDataSelect(toCells(events), dsQuery))
	for _, event := range events {
		eventDetail := ToEvent(event)
		eventList.Events = append(eventList.Events, eventDetail)
	}

	return eventList
}
func GenericDataSelect(dataList []DataCell, dsQuery *DataSelectQuery) []DataCell {
	SelectableData := DataSelector{
		GenericDataList: dataList,
		DataSelectQuery: dsQuery,
	}
	return SelectableData.Sort().Paginate().GenericDataList
}

Is there any particular consideration behind this design? Why does the event not support filtering?

What did you expect to happen?

'Event' can be filterBy attributes such as name, namespace, etc.

How can we reproduce it (as minimally and precisely as possible)?

try to curl /api/v1/event?filterBy=name,XXX, you’ll find that no filtering is applied at all.

Anything else we need to know?

No response

What browsers are you seeing the problem on?

No response

Kubernetes Dashboard version

api images: dashboard-api:1.10.1

Kubernetes version

Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.4", GitCommit:"95ee5ab382d64cfe6c28967f36b53970b8374491", GitTreeState:"clean", BuildDate:"2022-08-17T18:54:23Z", GoVersion:"go1.18.5", Compiler:"gc", Platform:"linux/amd64"} Kustomize Version: v4.5.4 Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.4", GitCommit:"95ee5ab382d64cfe6c28967f36b53970b8374491", GitTreeState:"clean", BuildDate:"2022-08-17T18:47:37Z", GoVersion:"go1.18.5", Compiler:"gc", Platform:"linux/amd64"}

Dev environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions