Enable leader election by default.#1476
Conversation
This consolidates the core of sharedmain around the new leaderelection logic, which will now be **enabled by default**. This can now be disabled with `--disable-ha` or by passing `sharedmain.WithHADisabled(ctx)` to `sharedmain.MainWithConfig`.
|
/hold While I stage things |
|
Downstream serving PR: knative/serving#8602 |
vagababov
left a comment
There was a problem hiding this comment.
/lgmt
/hold
if you want to upgrade to issue number.
| controllers, _ := ControllersAndWebhooksFromCtors(ctx, cmw, ctors...) | ||
| WatchLoggingConfigOrDie(ctx, cmw, logger, atomicLevel, component) | ||
| WatchObservabilityConfigOrDie(ctx, cmw, profilingHandler, logger, component) | ||
| // TODO(mattmoor): Remove this once HA is stable. |
|
/lgtm |
yanweiguo
left a comment
There was a problem hiding this comment.
/lgtm
I guess the title should be Enable leader election by default?
| func WebhookMainWithConfig(ctx context.Context, component string, cfg *rest.Config, ctors ...injection.ControllerConstructor) { | ||
| // MainWithConfig runs the generic main flow for controllers and webhooks | ||
| // with the given config. | ||
| func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, ctors ...injection.ControllerConstructor) { |
There was a problem hiding this comment.
If leader election mode is enabled, before this change:
- webhook is running on bucket level leader election mode.
- other controllers are running on pod level leader election mode.
After this change, all controllers are running on bucket level leader election mode. Is my understading right?
This race was uncovered by the chaos duck on knative/serving! When we have enabled a feature flag, e.g. multi-container, and the webhook pods are restarted, there is a brief window where the webhook is up and healthy before the configmaps have synchronized and the new webhook pod realizes the feature is enabled.
|
I pushed one additional change that was uncovered by the chaos testing downstream on serving. With this, I've had at least one clean run of serving (rerunning now) and just pushed it to the eventing PR. |
|
/lgtm /hold |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, vaikas The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
The following is the coverage report on the affected files.
|
|
/lgtm |
|
/hold cancel I am going to land this now, and after lunch I'll start rebasing and landing the downstream PRs. |
This consolidates the core of sharedmain around the new leaderelection logic, which will now be enabled by default.
This can now be disabled with
--disable-haor by passingsharedmain.WithHADisabled(ctx)tosharedmain.MainWithConfig./assign @pmorie @vagababov @markusthoemmes