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

Proposal: More reliable resource quota enforcement #20113

Closed

Conversation

derekwaynecarr
Copy link
Member

@derekwaynecarr derekwaynecarr commented Jan 25, 2016

This document describes how we can get more reliable quota enforcement.

@erictune - this addresses a question you had around multi-object transactions here:
#19761 (comment)

@bgrant0607 @lavalamp @smarterclayton - this calls out the need to populate object meta system fields before calling admission controllers. most notably, a UID would be really valuable in this context.

FYI:
@kubernetes/rh-cluster-infra


This change is Reviewable

@k8s-github-robot k8s-github-robot added kind/design Categorizes issue or PR as related to design. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 25, 2016
any corresponding reservation made by that object will be removed
since its consumption will properly be tracked in usage. If a
reservation has expired, it will be removed from the quota document.
A default expirationTime could be applied to sufficiently mitigate
Copy link
Contributor

Choose a reason for hiding this comment

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

Will apiserever.T6 fail if the corresponding quota expires?

@erictune erictune assigned lavalamp and unassigned brendandburns Jan 27, 2016
to allow for optimistic locking. If the quota usage
was stale, the admission control logic runs again
to validate the request is still valid with the latest
quota document.
Copy link
Member

Choose a reason for hiding this comment

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

What happens if the creation fails for other reasons afterwards?

@lavalamp
Copy link
Member

Is the design with the quota controller intended to be permanent? Or are we making the best of a bad situation here?

@bgrant0607
Copy link
Member

WRT the one question directed at me: Generating the uid earlier seems ok. We could create an interface for that so the resthandler could know whether a resource had uids and whether a Create actually created a resource (e.g., not a subresource).

@bgrant0607
Copy link
Member

cc @mml

@lavalamp
Copy link
Member

@derekwaynecarr I see this is sitting in my queue. What would you like to happen next on this?

@derekwaynecarr
Copy link
Member Author

I am closing this now, we can revisit it at a later time as its not yet a major issue.

I do want to send a separate PR though to allow for UID to generate earlier in the flow as we have discussed previously that can be stashed on a context.

@derekwaynecarr derekwaynecarr changed the title Proposal: More reliable resource quota enforcement WIP Proposal: More reliable resource quota enforcement May 6, 2016
@derekwaynecarr
Copy link
Member Author

Reopening this as its been a source of recent discussion at Red Hat. I may look to make some additional tweaks on this in the near term.

@derekwaynecarr derekwaynecarr reopened this May 6, 2016
@derekwaynecarr
Copy link
Member Author

derekwaynecarr commented May 6, 2016

@smarterclayton @deads2k - I think the reservation system discussed here fixes the N problem we discussed today, and avoids anything additional in admission control, but I could be wrong ;-)

incremental create occurs in the time that it recalculated usage
it will be told it has stale data and recalculate.

### ResourceQuota reservations
Copy link
Member Author

Choose a reason for hiding this comment

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

@deads2k - this should solve the latent list scenario unless I am mistaken. the replenishment controller would not release the reservation, so off by N scenarios should not happen in HA.

@derekwaynecarr derekwaynecarr changed the title WIP Proposal: More reliable resource quota enforcement Proposal: More reliable resource quota enforcement May 6, 2016
@derekwaynecarr
Copy link
Member Author

@smarterclayton @deads2k - Given our discussions around race windows in quota, I cleaned up this design proposal. I think it addresses the core problem around replenishment working against a latent API server (also raised here: #24494).

I am not committing implementation of this for Kubernetes 1.3, but it would be nice to have an agreement on a plan of attack given our experiments with a ClusterResourceQuota.

@bgrant0607
Copy link
Member

cc @davidopp

@bgrant0607
Copy link
Member

cc @davidopp

@deads2k
Copy link
Contributor

deads2k commented May 12, 2016

@smarterclayton @deads2k - Given our discussions around race windows in quota, I cleaned up this design proposal. I think it addresses the core problem around replenishment working against a latent API server (also raised here: #24494).

I think this closes the "off by N" hole. The actual structure may work move effectively as maps if we're trying to efficiently handle the "scale to 1000 instantly" case. 1000 is big enough to feel in an n-squared search loop ("is this one in the list, is this one in the list, etc").

@bgrant0607
Copy link
Member

cc @wojtek-t re. performance

and the requesting object is allowed to be created.
Quota usage is incremented using compare-and-swap
to allow for optimistic locking. If the quota usage
was stale, the admission control logic runs again
Copy link
Member

Choose a reason for hiding this comment

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

I assume "stale" means version number conflict? You should probably mention that explicitly.

@bgrant0607 bgrant0607 assigned davidopp and unassigned bgrant0607 Jun 25, 2016
## Data Model Impact

```
type ResourceQuotaReservation struct {
Copy link
Member

Choose a reason for hiding this comment

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

We need to document hidden state in etcd somewhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bgrant0607 - i know its been awhile, but what did you mean by hidden state? is the transient reservation concept hidden state in your view?

@k8s-github-robot k8s-github-robot added retest-not-required-docs-only do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. labels Jul 22, 2016
@bgrant0607 bgrant0607 removed their assignment Aug 9, 2016
@apelisse apelisse removed the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Aug 11, 2016
@k8s-bot
Copy link

k8s-bot commented Aug 16, 2016

GCE e2e build/test passed for commit 1e28e70.

@k8s-bot
Copy link

k8s-bot commented Aug 30, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-github-robot k8s-github-robot added kind/design Categorizes issue or PR as related to design. kind/old-docs labels Dec 1, 2016
@k8s-github-robot
Copy link

Adding label:do-not-merge because PR changes docs prohibited to auto merge
See http://kubernetes.io/editdocs/ for information about editing docs

@k8s-github-robot k8s-github-robot added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Dec 1, 2016
@k8s-github-robot
Copy link

This PR hasn't been active in 90 days. Closing this PR. Please reopen if you would like to work towards merging this change, if/when the PR is ready for the next round of review.

cc @davidopp @derekwaynecarr

You can add 'keep-open' label to prevent this from happening again, or add a comment to keep it open another 90 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. kind/design Categorizes issue or PR as related to design. release-note-none Denotes a PR that doesn't merit a release note. 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.

None yet