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
Simplify and de-layer Service REST implementation #96684
Simplify and de-layer Service REST implementation #96684
Conversation
4720632
to
5823d1d
Compare
/test pull-kubernetes-node-crio-e2e |
/assign @caesarxuchao |
@fedebongio @caesarxuchao no need for anyone to look at this yet except morbid curiosity :) |
staging/src/k8s.io/apiserver/pkg/registry/generic/registry/store.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/apiserver/pkg/registry/generic/registry/store.go
Outdated
Show resolved
Hide resolved
This is detrimental to future `blame` but makes it so much morereadable I convinced myself it was worthwhile.
More consistent overall.
This is consistent with every other registry. Service is no longer the oddball.
In all the places we pass (old, new) or (new, old), use wrapper-types to make sure that we don't flip the order by accident.
This was a dumb placeholder name.
Identified in review, these funcs are now more reslient to future changes.
91f1df9
to
009aa36
Compare
I have squashed FIXUP commits, updated all commit messages, and pushed - no code changes. |
/test pull-kubernetes-e2e-ipvs-azure-dualstack |
In response to this:
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. |
/lgtm here we go.. take cover! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: khenidak, thockin 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 |
/test pull-kubernetes-e2e-ubuntu-gce-network-policies |
@thockin: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
Simplify Service's REST implementation by using the Begin* hooks introduced in #96393. This is a large change overall, so the PR is a series of commits that are each designed to be easy to read and review, even if they are incomplete on their own.
Background:
Service has an "outer" and "inner" REST handler. This is because of how we do IP and port allocations synchronously, but since we don't have API transactions, we need to roll those back in case of a failure. Both layers use the same
Strategy
, but the outer calls into the inner, which causes a lot of complexity in the code (including an open-coded partial reimplementation of a date-unknown snapshot of the generic REST code) and results inPrepare
andValidate
hooks being called twice.This PR aims to merge those layers and use mostly generic REST code. This DOES NOT attempt to change or fix the way IPs and ports are allocated in the Service REST stack.
One net result of this is that the validation code can get a bit stricter, since it will NEVER see a service before allocation. This is left for later.
For posterity:
The "normal" REST flow seems to be:
Service (before this PR) does:
After this PR:
/kind bug
/kind cleanup
Fixes #87603
Fixes #98994
cc @khenidak @aojea
FYI @liggitt @deads2k @lavalamp
For followup PR(s):