Skip to content

Improve UX for using client-go generated Informers #181

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

Closed
wants to merge 1 commit into from

Conversation

pwittrock
Copy link
Contributor

No description provided.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pwittrock

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 25, 2018
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 25, 2018
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 25, 2018
Copy link
Contributor

@droot droot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few questions/suggestions.

@@ -135,6 +135,14 @@ func (r RunnableFunc) Start(s <-chan struct{}) error {
return r(s)
}

// StartAdapter wraps a Start function to make it implement Runnable
func StartAdapter(s func(<-chan struct{})) Runnable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To a new user it will read as ---> This starts some sort of an adapter. Other names that comes to mind are: MakeRunnable, StartFnAdapter.

s(c)
return nil
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like manager pkg to export just the essentials functions/methods. Functions like these, which are syntax sugar, should belong to some sister utils pkg like we controllerutils for controller helpers.

Backward compatibility contracts with core methods/functions are going to be more stricter than these utils/helpers pkgs. WDYT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

// Setup Watch using the client-go generated Informer
if err := ctrl.Watch(
&source.Informer{InformerProvider: generatedInformers.Core().V1().Services()},
&handler.EnqueueRequestForObject{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am reading correctly, there is an order requirement here. Informer source should only start after the informer Runnable has started and sync'ed ? Not sure how that is enforced. Will look into the code. I may be wrong also about the ordering requirement.

Informer toolscache.SharedIndexInformer

// InformerProvider provides a generated client-go Informer. Mutually exclusive with Informer.
InformerProvider InformerProvider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informer term is being overused and source.Informer and client-go.Informer are getting mixed up in my head and causing confusion. Don't have a better suggestions.

@pwittrock pwittrock closed this Feb 8, 2019
DirectXMan12 pushed a commit that referenced this pull request Jan 31, 2020
Add test for memcached-api-server project
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants