Skip to content

Commit

Permalink
Merge pull request kubernetes#22951 from derekwaynecarr/flake_ns
Browse files Browse the repository at this point in the history
Auto commit by PR queue bot
  • Loading branch information
k8s-merge-robot committed Mar 15, 2016
2 parents e290a10 + 775c5a2 commit a17a475
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugin/pkg/admission/namespace/lifecycle/admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ func (l *lifecycle) Admit(a admission.Attributes) (err error) {
// if we're here, then the API server has found a route, which means that if we have a non-empty namespace
// its a namespaced resource.
if len(a.GetNamespace()) == 0 || a.GetKind() == api.Kind("Namespace") {
// if a namespace is deleted, we want to prevent all further creates into it
// while it is undergoing termination. to reduce incidences where the cache
// is slow to update, we forcefully remove the namespace from our local cache.
// this will cause a live lookup of the namespace to get its latest state even
// before the watch notification is received.
if a.GetOperation() == admission.Delete {
l.store.Delete(&api.Namespace{
ObjectMeta: api.ObjectMeta{
Name: a.GetName(),
},
})
}
return nil
}

Expand Down

0 comments on commit a17a475

Please sign in to comment.