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

Replace snapshotter in pkg/backends with a GCE cloud lister implementation that is solely used for garbage collection #514

Closed

Conversation

rramkumar1
Copy link
Contributor

@rramkumar1 rramkumar1 commented Oct 18, 2018

Currently, pkg/backends uses a snapshotter which is used to keep some state on what backends that the controller managed. This snapshotter lists from the cloud periodically but this is unnecessary. We only need to list from the cloud when we are performing garbage collection.

This PR adds a new package called cloudlist which contains an implementation for a simple cloud lister that is decoupled from the existing snapshotter. The existing snapshotter implementation in pkg/backends is then replaced with the new cloud listing implementation.

The goal is to use the new cloud lister in pkg/loadbalancers and pkg/instances as well. Once this is done, the snapshotter code in pkg/pools can be completely removed.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rramkumar1

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 18, 2018
…ation that is solely used for garbage collection
@rramkumar1 rramkumar1 force-pushed the remove-uses-of-snapshotter branch from 1ce2944 to 315742e Compare October 18, 2018 20:24
@rramkumar1 rramkumar1 changed the title Replace snapshotter in pkg/backends with a GCE cloud lister implementation that is solely used for garbage collection [WIP] Replace snapshotter in pkg/backends with a GCE cloud lister implementation that is solely used for garbage collection Oct 18, 2018
@rramkumar1
Copy link
Contributor Author

/assign @bowei

Copy link
Contributor

@agau4779 agau4779 left a comment

Choose a reason for hiding this comment

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

LGTM

keyFunc := func(i interface{}) (string, error) {
bs := i.(*compute.BackendService)
if !namer.NameBelongsToCluster(bs.Name) {
return "", fmt.Errorf("unrecognized name %v", bs.Name)
}
return bs.Name, nil
}
backendPool.snapshotter = storage.NewCloudListingPool("backends", keyFunc, backendPool, 30*time.Second)
backendPool.gceLister = cloudlist.NewGCELister("backends", keyFunc, backendPool)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to share the backends lister with anything outside pkg/backends?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope.

@rramkumar1
Copy link
Contributor Author

/assign @freehan

@rramkumar1
Copy link
Contributor Author

Closing in favor of #590

@rramkumar1 rramkumar1 closed this Dec 21, 2018
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.

5 participants