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

informer not work #849

Open
1 of 4 tasks
13567436138 opened this issue Jan 5, 2025 · 0 comments
Open
1 of 4 tasks

informer not work #849

13567436138 opened this issue Jan 5, 2025 · 0 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@13567436138
Copy link

13567436138 commented Jan 5, 2025

Area

  • Scheduler
  • Controller
  • Helm Chart
  • Documents

Other components

No response

What happened?

according my debug

elasticQuotaInformer.AddEventHandler(cache.FilteringResourceEventHandler{
		FilterFunc: func(obj interface{}) bool {
			switch t := obj.(type) {
			case *v1alpha1.ElasticQuota:
				return true
			case cache.DeletedFinalStateUnknown:
				if _, ok := t.Obj.(*v1alpha1.ElasticQuota); ok {
					return true
				}
				utilruntime.HandleError(fmt.Errorf("cannot convert to *v1alpha1.ElasticQuota: %v", obj))
				return false
			default:
				utilruntime.HandleError(fmt.Errorf("unable to handle object in %T", obj))
				return false
			}
		},
		Handler: cache.ResourceEventHandlerFuncs{
			AddFunc:    c.addElasticQuota,
			UpdateFunc: c.updateElasticQuota,
			DeleteFunc: c.deleteElasticQuota,
		},
	})

	podInformer := handle.SharedInformerFactory().Core().V1().Pods().Informer()
	podInformer.AddEventHandler(
		cache.FilteringResourceEventHandler{
			FilterFunc: func(obj interface{}) bool {
				switch t := obj.(type) {
				case *v1.Pod:
					return assignedPod(t)
				case cache.DeletedFinalStateUnknown:
					if pod, ok := t.Obj.(*v1.Pod); ok {
						return assignedPod(pod)
					}
					return false
				default:
					return false
				}
			},
			Handler: cache.ResourceEventHandlerFuncs{
				AddFunc:    c.addPod,
				UpdateFunc: c.updatePod,
				DeleteFunc: c.deletePod,
			},
		},
	)

handler func will not run

What did you expect to happen?

add update delete will work

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

No response

Anything else we need to know?

No response

Kubernetes version

1.31

Scheduler Plugins version

1.31
@13567436138 13567436138 added the kind/bug Categorizes issue or PR as related to a bug. label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

1 participant