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

pluggable leader election strategy #3400

Merged
merged 2 commits into from
Jul 6, 2020

Conversation

lionelvillard
Copy link
Member

@lionelvillard lionelvillard commented Jun 24, 2020

For #3157

Proposed Changes

  • Allow for various leader election strategies.

Release Note


Docs

Since the implementation provided by k8s is buggy and not optimal (pull only) we need a way to replace it.

Depends on #3384

@knative-prow-robot knative-prow-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 24, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jun 24, 2020
@knative-prow-robot knative-prow-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 24, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lionelvillard

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 24, 2020
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 29, 2020
@lionelvillard lionelvillard changed the title WIP: pluggable leader election strategy pluggable leader election strategy Jun 29, 2020
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 29, 2020
@aslom
Copy link
Member

aslom commented Jun 29, 2020

/assign

@aslom
Copy link
Member

aslom commented Jun 29, 2020

Going though the code - looks like functionality like that is needed for HA scalable adapters in Knative eventing.

I think we should experiment with it and to do this we need that code to be in knative eventing

@aslom
Copy link
Member

aslom commented Jun 29, 2020

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 29, 2020
@matzew
Copy link
Member

matzew commented Jun 30, 2020

I see a WARNING: DATA RACE reported in the failed test

@lionelvillard
Copy link
Member Author

lionelvillard commented Jun 30, 2020

I saw that. It's in the k8s go client lib. Instead of copy&paste this code maybe we should just patch it but I don't know how to do this now that we use go mod. Wrong comment for this PR.

@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 6, 2020
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/adapter/v2/main.go 63.3% 61.9% -1.4
pkg/adapter/v2/main_message.go 58.7% 56.4% -2.3
pkg/leaderelection/context.go Do not exist 78.8%

@aslom
Copy link
Member

aslom commented Jul 6, 2020

I think we need that code and tests passed.

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 6, 2020
@knative-prow-robot knative-prow-robot merged commit dcba563 into knative:master Jul 6, 2020
pkgleaderelection "knative.dev/pkg/leaderelection"
"knative.dev/pkg/logging"
"knative.dev/pkg/system"
)
Copy link
Member

Choose a reason for hiding this comment

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

I just came across this trying to enable HA by default for our controlplane components, which eliminates the enabledComponents and the LeaderElect fields from knative/pkg.

This code has zero eventing dependencies, and forks a ton of the PKG logic into eventing. 😞

Is there a design or a feature track document for this anywhere...?

Copy link
Member Author

Choose a reason for hiding this comment

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

this code is almost the same as the one found in PKG except it depends on adapter.Adapter instead of reconciler.LeaderAware. (there was issues with directly imported adapter.Adapter from context.go so the interface is duplicated in this file).

I would like to consolidate the two together, and maybe reconciler.LeaderAware is the right abstraction but I'm not sure yet. That's on my TODO list for 0.17.

@lionelvillard lionelvillard deleted the le-interface branch September 3, 2020 15:33
@lionelvillard lionelvillard restored the le-interface branch September 3, 2020 15:42
@lionelvillard lionelvillard deleted the le-interface branch September 3, 2020 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. 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.

7 participants