jetstack / navigator

Managed Database-as-a-Service (DBaaS) on Kubernetes
Apache License 2.0
271 stars 31 forks source link

Perform leaderelection in GenericPilot #186

Closed munnerz closed 6 years ago

munnerz commented 6 years ago

What this PR does / why we need it:

Adds a leaderelection package and implements leader election in the GenericPilot.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Closes #97

Release note:

Add support for leader election in pilots
munnerz commented 6 years ago

/test e2e

munnerz commented 6 years ago

@wallrj this is ready for review now.

I think the best way for us to write tests for this is probably with integration tests for GenericPilot itself. The leaderelection package doesn't really need much testing as it is largely just a convenient proxy to the upstream kubernetes package.

We can then provide our own SyncFunc and LeaderElectedSyncFunc, run two instances of GenericPilot and ensure that only one of them receives calls to LeaderElectedSyncFunc.

munnerz commented 6 years ago

/test e2e

wallrj commented 6 years ago

/lgtm

jetstack-ci-bot commented 6 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wallrj

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files: - ~~[OWNERS](https://github.com/jetstack/navigator/blob/master/OWNERS)~~ [wallrj] You can indicate your approval by writing `/approve` in a comment You can cancel your approval by writing `/approve cancel` in a comment
jetstack-ci-bot commented 6 years ago

/test all [submit-queue is verifying that this PR is safe to merge]

jetstack-ci-bot commented 6 years ago

Automatic merge from submit-queue.