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

🏃 Use controller-runtime cache for watching remote nodes over informers #2496

Merged
merged 2 commits into from
Mar 11, 2020

Conversation

JoelSpeed
Copy link
Contributor

What this PR does / why we need it:

As per suggestion in #2250, the watching of remote nodes could be improved by the introduction of the a KindWithCache source from controller-runtime. This feature is not yet released however. Once the next release of controller-runtime is made, and the project is happy to bump the dependency, this PR can be updated and the improvements merged

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2412

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 2, 2020
@JoelSpeed JoelSpeed force-pushed the remote-cache-watch branch from 4f4ef09 to d2ceaf9 Compare March 2, 2020 14:27
@JoelSpeed
Copy link
Contributor Author

I've manually tested this change doesn't break the remote watching of nodes, could see reconciliation occurring at the same timestamp as the node condition lastTransition occurred, so I think this is safe, just need to check the code over and wait for a CR release

@JoelSpeed JoelSpeed force-pushed the remote-cache-watch branch from d2ceaf9 to 0db5717 Compare March 2, 2020 16:31
@vincepri
Copy link
Member

vincepri commented Mar 6, 2020

/milestone v0.3.x

@k8s-ci-robot k8s-ci-robot added this to the v0.3.x milestone Mar 6, 2020
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 6, 2020
factory := informers.NewSharedInformerFactory(k8sClient, 0)
nodeInformer := factory.Core().V1().Nodes().Informer()
go nodeInformer.Run(ctx.Done())
go clusterCache.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.

xref #2577: I think we're going to need to able to stop a cache when the associated Cluster is deleted. This probably means creating a stop channel per cache and tracking it in the map, and adding logic that closes the stop channel for a cache if its corresponding Cluster is not found when reconciling.

@vincepri
Copy link
Member

@JoelSpeed https://github.com/kubernetes-sigs/controller-runtime/releases new controller runtime release is up

@JoelSpeed JoelSpeed force-pushed the remote-cache-watch branch from 0db5717 to 092ee97 Compare March 11, 2020 09:50
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 11, 2020
@JoelSpeed
Copy link
Contributor Author

Thanks @vincepri for the ping. I've updated the PR to update the dependencies to the new patch release. Put this as a separate commit for now, wasn't sure whether it was ok to just merge in with this of if it should be separate for some reason?

@JoelSpeed JoelSpeed changed the title [WIP] ✨ Use cache for watching remote nodes over informers ✨ Use cache for watching remote nodes over informers Mar 11, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2020
@vincepri
Copy link
Member

/milestone v0.3.1

@k8s-ci-robot k8s-ci-robot modified the milestones: v0.3.x, v0.3.1 Mar 11, 2020
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed, vincepri

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 Mar 11, 2020
@vincepri
Copy link
Member

@ncdc did you want to take a final look here?

@ncdc
Copy link
Contributor

ncdc commented Mar 11, 2020

Sure, on it now

@ncdc
Copy link
Contributor

ncdc commented Mar 11, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2020
@vincepri
Copy link
Member

/retitle 🏃 Use controller-runtime cache for watching remote nodes over informers

@k8s-ci-robot k8s-ci-robot changed the title ✨ Use cache for watching remote nodes over informers 🏃 Use controller-runtime cache for watching remote nodes over informers Mar 11, 2020
@k8s-ci-robot k8s-ci-robot merged commit e3d592f into kubernetes-sigs:master Mar 11, 2020
@JoelSpeed JoelSpeed deleted the remote-cache-watch branch March 11, 2020 16:56
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Watching node in remote clusters should use a cache
5 participants