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

Efficient watch resumption #94364

Merged
merged 5 commits into from
Sep 25, 2020

Conversation

wojtek-t
Copy link
Member

Ref kubernetes/enhancements#1904

/kind feature

NONE

@wojtek-t wojtek-t self-assigned this Aug 31, 2020
@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. release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. 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. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 31, 2020
@wojtek-t wojtek-t added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Aug 31, 2020
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 31, 2020
@wojtek-t wojtek-t force-pushed the efficient_watch_resumption branch 4 times, most recently from 5a1a277 to 24140dc Compare September 1, 2020 07:20
@wojtek-t wojtek-t force-pushed the efficient_watch_resumption branch from 24140dc to 0c97c57 Compare September 1, 2020 09:32
@k8s-ci-robot k8s-ci-robot added area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Sep 1, 2020
@wojtek-t wojtek-t force-pushed the efficient_watch_resumption branch from 0c97c57 to e2d96bf Compare September 1, 2020 11:17
@wojtek-t wojtek-t closed this Sep 1, 2020
@wojtek-t wojtek-t reopened this Sep 1, 2020
@fedebongio
Copy link
Contributor

/cc @lavalamp

@jingyih
Copy link
Contributor

jingyih commented Sep 11, 2020

@lavalamp @deads2k - this is ready for the first pass of review - PTAL when you will have chance (there are some missing unit tests blocked on etcd changes to their integration framework use, but that doesn't block reviewing the main code changes)

I just sent #94711 to see if we can unblock this PR sooner.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 12, 2020
@wojtek-t wojtek-t force-pushed the efficient_watch_resumption branch from 64f732e to af61e8f Compare September 15, 2020 06:19
@k8s-ci-robot k8s-ci-robot added sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 15, 2020
@wojtek-t
Copy link
Member Author

/retest

@wojtek-t
Copy link
Member Author

@lavalamp @deads2k - this is ready for the next pass - all dependencies are also merged and the PR is complete. PTAL

@@ -258,7 +258,7 @@ func (c *Config) createLeaseReconciler() reconcilers.EndpointReconciler {
if err != nil {
klog.Fatalf("Error determining service IP ranges: %v", err)
}
leaseStorage, _, err := storagefactory.Create(*config)
leaseStorage, _, err := storagefactory.Create(*config, nil)
Copy link
Member

Choose a reason for hiding this comment

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

Instead of changing every call site, can the new parameter be a member of the config struct?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good point - will fix tomorrow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually - this is part of createLeaseResonciler() method - this is basically callled once in the kube-apiserver lifetime.
So I don't think it makes sense to change anything.

Copy link
Member

Choose a reason for hiding this comment

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

I meant to include all the "generic.NewRawStorage(config, nil)" calls, too. If you think it's not worth it, that's fine.

It still seems weird to me to have a config thingy, and an option that's not part of the config thingy. What is the rule for adding to the config thingy vs adding another parameter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically it may be possible to make it a part of config.

That said I looked deeper into the code (this time again), and piping the necessary information down to storageConfig (if we do that, we shouldn't pipe newFunc, but rather groupKind and use ObjectCreator from runtime.Scheme to create object) and that would be at least couple hundreds line of code (and e.g. path for CRDs is different than for built-in resources there).

I'm happy to look at this, but given this commit is actually fairly simple and relatively small (and almost all changes are in tests), I would prefer to not block this PR on it, so that we can get more soaking time of the feature itself.

If you're fine with this, I'm happy to open an issue and assign to myself to fix that once this one is merged.

Copy link
Member

Choose a reason for hiding this comment

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

What you have sounds better than plumbing it everywhere. I guess I was expecting something like, this code makes a shallow copy of the config and sets the additional field, so it'd be about the same change as what you have here, just call sites that are happy with nil wouldn't need to change at all.

But I wouldn't insist on this or anything, it might not be an improvement.

client: client,
codec: codec,
newFunc: newFunc,
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little surprised you can't get this out of the codec or versioner already.

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately you can't.
Codec only supports encoding and decoding:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/runtime/interfaces.go#L94
Versioner is only about conversions:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/runtime/interfaces.go#L220

There is ObjectCreater interface:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/runtime/interfaces.go#L254
that our runtime.Scheme implements, but that doesn't really change much in terms of passing arguments.

@lavalamp
Copy link
Member

I'd like one more set of eyes on this before I approve, @jingyih can you review? I see you're already in the comments.

/assign @jingyih

Copy link
Contributor

@jingyih jingyih left a comment

Choose a reason for hiding this comment

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

/lgtm

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lavalamp, wojtek-t

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

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

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. area/apiserver area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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.

8 participants