-
Notifications
You must be signed in to change notification settings - Fork 8
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
Use informers #16
base: master
Are you sure you want to change the base?
Use informers #16
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments but otherwise lgtm (apart from test coverage)
func (c *Controller) disableSrcDstCheck(key string) error { | ||
defer c.workqueue.Done(key) | ||
|
||
return retry.RetryOnConflict(retry.DefaultBackoff, func() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to have a less greedy retry that does not calling 'c.modifySrcDstCheckAttribute' again if there's a conflict?
} | ||
|
||
func (c *Controller) checkSrcDstAttributeEnabled(key string) (enabled bool, err error) { | ||
defer c.workqueue.Done(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this method call 'c.workqueue.Done' is a bit hard to follow. Perhaps it can be placed before :
https://github.com/ottoyiu/k8s-ec2-srcdst/pull/16/files#diff-bff40c211a4e0c5aed5c55ab3cdbda41R10
and have the failure cases on 'processNextWorkItem' return early instead.
if _, ok := node.Annotations[SrcDstCheckDisabledAnnotation]; ok { | ||
srcDstCheckEnabled = false | ||
func (c *Controller) disableSrcDstCheck(key string) error { | ||
defer c.workqueue.Done(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise to my other comment regarding modifying the workqueue in this method.
hey @gjtempleton, I will work on merging this soon! |
This PR depends on PR #15.
This reimplements src-dst controller to use informers and workqueue. Will fix/add more tests and test on a cluster.