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

Add leader election to transflect #8

Open
preetim-cash opened this issue Sep 6, 2021 · 1 comment · Fixed by #6
Open

Add leader election to transflect #8

preetim-cash opened this issue Sep 6, 2021 · 1 comment · Fixed by #6

Comments

@preetim-cash
Copy link
Collaborator

Implement leader election to transflect

@preetim-cash preetim-cash reopened this Sep 6, 2021
juliaogris pushed a commit that referenced this issue Sep 7, 2021
Refactor, reformat, rename and reorganise markdown, yaml and go code
files in preparation for leader election. This PR was created as all
non-functional changes for the leader-election implementation so that
leader-election is purely functional and can be more easily reviewed
with care (see #7 ).

Issue: #8

This merges the following commits:
* Reformat markdown files with prettier
* Reformat transflect deployment yaml file
* Refactor operator main
* Update inline code comments comment
* Rework operator initialisation
* Change function order
* Reorganise Replicaset/Filter processing
* Fix informer run call

     README.md                           | 145 +++++++-------
     cmd/transflect-operator/main.go     |  40 +---
     cmd/transflect-operator/operator.go | 296 ++++++++++++++--------------
     cmd/transflect-operator/probes.go   |  42 ++++
     deployment/transflect.yaml          |  56 ++----
     docs/inner-workings.md              |  65 +++---
     docs/local-cluster.md               |  84 ++++----
     7 files changed, 358 insertions(+), 370 deletions(-)

Pull-Request: #6
@juliaogris
Copy link
Contributor

Dang Github, I didn't say Closes: #8, I just referenced it in PR #6.
Reopening.

@juliaogris juliaogris reopened this Sep 7, 2021
juliaogris pushed a commit that referenced this issue Sep 9, 2021
Add leader-election to operator so that several operators may be ready
in a cluster, but only one at a time executes.

Add cleanup on cancelled context to probes server and signal handler, to
ensure quick leaser release and handover.

This change leans heavily on k8s client-go leader-election example.
https://github.com/kubernetes/client-go/blob/a31b18a6ac98bbff0dd1055707dfde1b0a98ff68/examples/leader-election/main.go

There are no tests for the leader election, but I have manually tested it.

This PR is a re-creation of #7 which got deleted as it was a stacked PR with #6 and not rebased before merge/delete of base branch.

issue: #8

This merges the following commits:
* Add leader-election to operator

     Makefile                            |  2 +-
     README.md                           |  1 +
     cmd/transflect-operator/main.go     | 33 +++++-----
     cmd/transflect-operator/operator.go | 97 ++++++++++++++++++++++++-----
     cmd/transflect-operator/probes.go   |  6 +-
     deployment/transflect.yaml          |  7 +++
     go.mod                              |  1 +
     go.sum                              |  2 +
     8 files changed, 117 insertions(+), 32 deletions(-)

Pull-Request: #9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants