-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Replace per-PVC leader election with per-cluster #892
Conversation
@orainxiong please review. 1st commit is taken from your work at #837 (thanks) 2nd commit is the replacement leader election. It will create an endpoints object in namespace kube-system with name equal to Some open questions:
/cc @cofyc |
ec85e58
to
e906dce
Compare
also TODO for me tomorrow: fix NFS docs, I think they reference hostpath daemonsets and such somewhere which won't be possible anymore :p |
LGTM! You have a better workaround, and I have closed related issues in If possible I will measure the effects of this pr for performance improvement with the same test case of BTW, as far as I know, the
I hope it works. |
I don't really understand the bug, how common is it? How can tryAcquireOrRenew get stuck? I don't want to bump all the k8s.io/* dependencies to master. :/ Since upstream did not think it's important enough to cherry-pick I am inclined to live with the bug for now. |
51851a4
to
a682b20
Compare
I will probably tag |
BTW, I also want to make the leader election opt-out. I.e., allow the author to do leader election at some higher level (in their |
lib/controller/controller.go
Outdated
@@ -141,10 +142,6 @@ type ProvisionController struct { | |||
// when multiple controllers are running: they race to lock (lead) every PVC | |||
// so that only one calls Provision for it (saving API calls, CPU cycles...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment should be updated
pvName := ctrl.getProvisionedVolumeNameForClaim(claim) | ||
volume, err := ctrl.client.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{}) | ||
if err == nil && volume != nil { | ||
_, exists, err := ctrl.volumes.GetByKey(fmt.Sprintf("%s/%s", namespace, pvName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we check volume existence in cache.Store
, perhaps we should wait informers are fully synced before running any controller logic.
lib/controller/controller.go
Outdated
go ctrl.claimController.Run(stopCh) | ||
go ctrl.volumeController.Run(stopCh) | ||
go ctrl.classController.Run(stopCh) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache.WaitForCacheSync(stopCh, ctrl.claimInformer.HasSynced, ctrl.volumeInformer.HasSynced, ctrl.classInformer.HasSynced)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh , should use controller.HasSynced
, ctrl.xxxInformer is optional.
cache.WaitForCacheSync(stopCh, ctrl.claimController.HasSynced, ctrl.volumeController.HasSynced, ctrl.classController.HasSynced)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, thank you
While I was looking at this code, I also think it is a bug that we call Run
for SharedInformers. Users of lib should be able to Run
the SharedInformers whenever they want... May as well fix it while we are here IMO
4e1ba01
to
4ea77e4
Compare
Last call for review @cofyc I will merge this tomorrow and tag a release. I plan to fix the nfs e2e tests in a separate pr. I’ve revamped them so they’re not so fragile Other than the e2e testing I’ve done some local testing. Probably not sufficient but it can’t be helped. Anyway the code is identical to controller manager so we should be okay |
/lgtm |
…nts permissions, consolidate where possible
4ea77e4
to
8052cf7
Compare
New changes are detected. LGTM label has been removed. |
/lgtm |
@wongma7: you cannot LGTM your own PR. 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. |
@wongma7 Hi, this change break Openshift testing... Openshift does not have resource |
@funky81 please try the new RBAC with the latest release v3.0.0-k8s1.11 @weherdh sorry, I removed the SCC without a replacement https://github.com/kubernetes-incubator/external-storage/pull/892/files#diff-fbc2b7e3391a05df13aa2ae2e9e9831a. Please feel free to open a bug so I can track it. In openshift instead of creating PSP we create SCC and it should work right? |
continuing work in #837