Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request]extract list object handling from ObjectFilter to ResponseFilter #1990

Closed
rambohe-ch opened this issue Mar 25, 2024 · 0 comments · Fixed by #1991
Closed
Labels
kind/feature kind/feature

Comments

@rambohe-ch
Copy link
Member

What would you like to be added:
In each ObjectFilter(like masterservice, servicetopology, etc.), filter need to handle standalone object and List object. For example, masterservice filter need to handle *v1.ServiceList and *v1.Service as following:

func (msf *masterServiceFilter) Filter(obj runtime.Object, _ <-chan struct{}) runtime.Object {
switch v := obj.(type) {
case *v1.ServiceList:
for i := range v.Items {
mutated := msf.mutateMasterService(&v.Items[i])
if mutated {
// short-circuit break
break
}
}
return v
case *v1.Service:
msf.mutateMasterService(v)
return v

And handling list object is just a collection of standalone object handling, so it is a good idea to handle list object in a common place like ResponseFilter instead of handling them in every ObjectFilter.

So i will make a pull request to improve list object handling in ObjectFilter, then ObjectFilter only need to handle standalone object(like *v1.Service).

others
/kind feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature kind/feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant