Skip to content

compensate for raft/cache delay in namespace admission - #10911

Merged
openshift-bot merged 2 commits into
openshift:masterfrom
liggitt:namespace-admission-wait
Sep 22, 2016
Merged

openshift-bot merged 2 commits into
openshift:masterfrom
liggitt:namespace-admission-wait

Conversation

@liggitt

@liggitt liggitt commented Sep 14, 2016 •

Copy link
Copy Markdown
Contributor

When attempting to create an object in a just-created namespace, the admission plugin can reject the creation attempt for two reasons:

  1. The cache of existing namespaces has not observed the creation watch event yet. There was already compensation to perform a live lookup if the namespace was not found in the cache.
  2. The live lookup can be performed against a non-leader in a HA etcd setup, and can return NotFound if the non-leader etcd has not observed the creation.

This PR adds a delay, then rechecks the cache before proceeding with the live lookup. This gives both the cache and the backing storage more time to observe the create, before failing the request.

Fixes #10909

@liggitt

liggitt commented Sep 14, 2016

Copy link
Copy Markdown
Contributor Author

@deads2k @derekwaynecarr

@liggitt

liggitt commented Sep 14, 2016

Copy link
Copy Markdown
Contributor Author

[test]

@deads2k

deads2k commented Sep 14, 2016

Copy link
Copy Markdown
Contributor

lgtm. This should hold on the rebase. The code in this admission plugin changes in 1.4

@liggitt

liggitt commented Sep 14, 2016

Copy link
Copy Markdown
Contributor Author

I expect we'll want a backport to 3.3.1

// in case of latency in our caches, make a call direct to storage to verify that it truly exists or not
// as a last resort, make a call directly to storage
// this also benefits from the Sleep() above allowing for propagation in HA storage cases
namespaceObj, err = l.client.Core().Namespaces().Get(a.GetNamespace())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I also would be fine skipping this, using a poller for X milliseconds on the cache, and skipping the "live" check altogether.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Having just debugged a ton of namespace deletion flakes, I am cautious about doing two changes like this at once even though I know that is not rational.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

to clarify, i mean i want to wait 50ms AND keep continuing to do the live call. so suspenders with the belt.

@liggitt

liggitt commented Sep 14, 2016 •

Copy link
Copy Markdown
Contributor Author

and we want this for 1.3.0 or 1.3.1

@deads2k

deads2k commented Sep 14, 2016

Copy link
Copy Markdown
Contributor

and we want this for 1.3.0/1.3.1

No objection from me, but aren't those branches already split?

@liggitt

liggitt commented Sep 14, 2016 •

Copy link
Copy Markdown
Contributor Author

aren't those branches already split?

imminently

@liggitt liggitt modified the milestones: 1.3.0, 1.3.1 Sep 14, 2016
@liggitt

liggitt commented Sep 14, 2016

Copy link
Copy Markdown
Contributor Author


if !exists {
// give the cache time to observe a recent namespace creation
time.Sleep(50 * time.Millisecond)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: put this in a big fat constant at top of file?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is also not just namespace creation. if a namespace is deleted, we purge it from the local store.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved to constant, and also limited this to create cases

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 14d24cb

@openshift-bot

Copy link
Copy Markdown
Contributor

@liggitt

liggitt commented Sep 22, 2016

Copy link
Copy Markdown
Contributor Author

[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 14d24cb

@openshift-bot

openshift-bot commented Sep 22, 2016 •

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8930/) (Image: devenv-rhel7_5058)

@openshift-bot
openshift-bot merged commit 668069c into openshift:master Sep 22, 2016
@liggitt
liggitt deleted the namespace-admission-wait branch September 26, 2016 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants