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

Move NamespaceLifecycle to use shared informers #29926

Merged

Conversation

derekwaynecarr
Copy link
Member

This was a follow-up to #29634

Moves the NamespaceLifecycle plug-in to a shared infomer cache.

/cc @kubernetes/rh-cluster-infra @deads2k @hodovska

@derekwaynecarr
Copy link
Member Author

@hodovska - figured I would take this the last mile since you were looking at the controllers.

namespaceInformer framework.SharedIndexInformer
// forceLiveLookupCache holds a list of entries for namespaces that we have a strong reason to believe are stale in our local cache.
// if a namespace is in this cache, then we will ignore our local state and always fetch latest from api server.
forceLiveLookupCache *lru.Cache
Copy link
Contributor

Choose a reason for hiding this comment

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

You sure you want to use an LRU instead of a layer that marks the deletion alongside a resourceversion and uses a versionercomparator to know when it expires? This is vulnerable to mass deletion paging you out against a stale cache.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally, I would like a layer, but thought that was a good follow-up with what @hodovska is doing.

In this case, I was less concerned about resource version comparison since all I really care about is that the version in my local cache is now in terminating phase which is the check we have later in this file. Good point on the mass deletion paging out the LRU. Not sure how concerned I am on that scenario if we will swap out with the layered store.

Copy link
Member Author

Choose a reason for hiding this comment

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

#22951

the history of the original behavior to modify the underlying store was done in the earlier PR to address flakes with single API server. It's understood that absent this change, in HA environments, there is still a race potential where API server 1 rejects a request (updated cache), and API server 2 accepts a request (stale cache), and the current background controller will hopefully observe and delete the late added resources as part of namespace clean-up.

so given the original scope of the intended fix, I think a limited size LRU is hopefully sufficient.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a deletedNamespaceCache that you're using to make a livelookup choice. Perhaps a rename?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not necessary deleted. It could either be terminating or deleted. I think I will just keep force live lookups for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not necessary deleted. It could either be terminating or deleted. I think I will just keep force live lookups for now.

Somehow I've missed that. It looked like you only called .Add during a Delete. can you link me to where else you're adding it?

Copy link
Member Author

Choose a reason for hiding this comment

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

it takes two calls to delete a namespace. delete 1 -> active to terminating, delete 2 -> gone from store. my point being that after the first delete, its not gone, just terminating.

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Aug 2, 2016
@hodovska
Copy link

hodovska commented Aug 3, 2016

#29978 this PR should cover tasks mentioned here: #26709 (comment)

)
reflector.Run()
func NewLifecycle(c clientset.Interface, immortalNamespaces sets.String) (admission.Interface, error) {
forceLiveLookupCache, err := lru.New(100)
Copy link
Contributor

Choose a reason for hiding this comment

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

the error only happens if you pass a value less than 1. You can safely panic on the err instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@deads2k
Copy link
Contributor

deads2k commented Aug 3, 2016

minor comments, lgtm otherwise.

@derekwaynecarr
Copy link
Member Author

nits addressed.

5*time.Minute,
)
reflector.Run()
func NewLifecycle(c clientset.Interface, immortalNamespaces sets.String) (admission.Interface, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function never returns an error.

@deads2k
Copy link
Contributor

deads2k commented Aug 4, 2016

lgtm, fix the signature if you get a chance or we can get it next time we're in here.

@deads2k deads2k added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 4, 2016
@k8s-bot
Copy link

k8s-bot commented Aug 4, 2016

GCE e2e build/test passed for commit 4c37a81.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Aug 5, 2016

GCE e2e build/test passed for commit 4c37a81.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 353df20 into kubernetes:master Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. 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

6 participants