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]improve FieldIndexer setting in yurt-manager #1794

Closed
rambohe-ch opened this issue Nov 14, 2023 · 1 comment · Fixed by #1834
Closed

[feature request]improve FieldIndexer setting in yurt-manager #1794

rambohe-ch opened this issue Nov 14, 2023 · 1 comment · Fixed by #1834
Assignees
Labels
help wanted help wanted kind/feature kind/feature kind/good-first-issue kind/good-first-issue

Comments

@rambohe-ch
Copy link
Member

What would you like to be added:
In NodeLifeCycle and PodBinding controller of yurt-manager component, spec.nodeName IndexField has been used at present, and FieldIndexer setting is only needed to configured only once, and now is configured in NodeLifeCycle controller as following:

if err := mgr.GetFieldIndexer().IndexField(context.TODO(), &v1.Pod{}, nodeNameKeyIndex, func(rawObj client.Object) []string {
pod, ok := rawObj.(*v1.Pod)
if !ok {
return []string{}
}
if len(pod.Spec.NodeName) == 0 {
return []string{}
}
return []string{pod.Spec.NodeName}
}); err != nil {
klog.Errorf("could not register spec.NodeName field indexers for nodelifecycle controller, %v", err)
return err
}

This FieldIndexer setting is shared by two controllers, maybe it is a good idea to move this sharing setting as a public setting instead of configuring in NodeLifeCycle controller.

Because in some scenarios, users like to disable NodeLifeCycle controller, so FieldIndexer setting will not be configured, then an error happens in PodBinding controller as following:

E1113 13:40:14.428554       1 podbinding_controller.go:180] pod-binding-controller: failed to get podList for node(izbp13108hhdvq7ver655tz), Index with name field:spec.nodeName does not exist
E1113 13:40:14.428590       1 controller.go:317] setup/controller/pod-binding-controller "msg"="Reconciler error" "error"="Index with name field:spec.nodeName does not exist" "name"="izbp13108hhdvq7ver655tz" "namespace"=""

others
/kind feature

@rambohe-ch rambohe-ch added kind/feature kind/feature help wanted help wanted kind/good-first-issue kind/good-first-issue and removed kind/good-first-issue kind/good-first-issue labels Nov 14, 2023
@rambohe-ch rambohe-ch added the kind/good-first-issue kind/good-first-issue label Nov 21, 2023
@2456868764
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted help wanted kind/feature kind/feature kind/good-first-issue kind/good-first-issue
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants