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

[V2] refactor: start informers in one place #1607

Merged
merged 1 commit into from
Dec 7, 2022

Conversation

hccheng72
Copy link

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Start informers centrally and share them with crdprovisioner and controllers to prevent dependency.

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

Release note:

none

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 18, 2022
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 18, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @hccheng72. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 18, 2022
@hccheng72
Copy link
Author

/assign @sunpa93

@edreed
Copy link
Collaborator

edreed commented Nov 18, 2022

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 18, 2022
@@ -461,7 +465,7 @@ func (d *DriverV2) registerAzDriverNodeOrDie(ctx context.Context) {

nodeSelector := fmt.Sprintf("metadata.name=%s", d.NodeID)

azdiskInformer := azdiskinformers.NewSharedInformerFactoryWithOptions(
azdiskInformerFactory := azdiskinformers.NewSharedInformerFactoryWithOptions(
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this method starts a member informer of DriverV2, I am wondering if we should refactor and start it at the beginning of driver setup with the rest of the informers if d.config.NodeConfig.Enabled

Copy link
Author

Choose a reason for hiding this comment

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

I don't include it to this refactoring for now. Since this informer has an additional need for Lister() method here, I don't see many benefits to combine it with other informers. We could reconsider if we have a better idea.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 1, 2022
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 3, 2022
@hccheng72 hccheng72 force-pushed the informers-refactor branch 3 times, most recently from 52dfee5 to 4ae562b Compare December 3, 2022 03:50
@@ -475,7 +481,7 @@ func (d *DriverV2) registerAzDriverNodeOrDie(ctx context.Context) {
},
})

go azdiskInformer.Start(ctx.Done())
azdiskInformerFactory.Start(ctx.Done())
Copy link
Contributor

Choose a reason for hiding this comment

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

We should utilize azureutils.StartAndWaitForCacheSync instead of manually starting the informer here.

Copy link
Author

Choose a reason for hiding this comment

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

If we want to use azureutils.StartAndWaitForCacheSync, we need to create an object as GenericInformer interface. But this informer needs Lister() method here, we need to add this method/field to GenericInformer interface and GenericAzInformerInfo struct that would cause all other informers need to initiate lister field which won't be used. That's why I manually start this informer. Any other suggestion?

@edreed
Copy link
Collaborator

edreed commented Dec 7, 2022

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 7, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edreed, hccheng72

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 7, 2022
@k8s-ci-robot k8s-ci-robot merged commit b084d41 into kubernetes-sigs:main_v2 Dec 7, 2022
@hccheng72 hccheng72 deleted the informers-refactor branch December 7, 2022 21:33
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants