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 elect args #163

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

gujingit
Copy link
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it

Which issue(s) this PR fixes

Fixes #19

Special notes for your reviewer

Does this PR introduce a user-facing change?


@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 17, 2024
@k8s-ci-robot k8s-ci-robot requested review from ahg-g and liurupeng June 17, 2024 07:03
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 17, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @gujingit. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 17, 2024
@gujingit gujingit force-pushed the feature/leader-elect branch 2 times, most recently from 73763e3 to b693849 Compare June 17, 2024 08:07
@kerthcet
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 18, 2024
cmd/main.go Outdated Show resolved Hide resolved
@liurupeng
Copy link
Collaborator

Were you able to test manually to verify the leader election functionality work as expected? @gujingit

@gujingit
Copy link
Contributor Author

Were you able to test manually to verify the leader election functionality work as expected? @gujingit

Test 1: deploy lws-controller-manager with 2 replicas

  1. Deploy lws-controller-manager with 2 replicas
NAME                     READY   UP-TO-DATE   AVAILABLE   AGE
lws-controller-manager   2/2     2            2           28m
  1. Deploy a simple lws application
kubectl apply -f docs/examples/sample/lws.yaml 

outputs

NAME                         READY   STATUS    RESTARTS   AGE
leaderworkerset-sample-0     1/1     Running   0          9s
leaderworkerset-sample-0-1   1/1     Running   0          9s
leaderworkerset-sample-0-2   1/1     Running   0          9s
leaderworkerset-sample-0-3   1/1     Running   0          9s
leaderworkerset-sample-1     1/1     Running   0          9s
leaderworkerset-sample-1-1   1/1     Running   0          9s
leaderworkerset-sample-1-2   1/1     Running   0          9s
leaderworkerset-sample-1-3   1/1     Running   0          9s
leaderworkerset-sample-2     1/1     Running   0          9s
leaderworkerset-sample-2-1   1/1     Running   0          9s
leaderworkerset-sample-2-2   1/1     Running   0          9s
leaderworkerset-sample-2-3   1/1     Running   0          9s

Test 2: Leader election lost

  1. Get the current leader
NAME                                      READY   STATUS    RESTARTS   AGE
lws-controller-manager-77489f74b8-74mwv   2/2     Running   0          8m19s
lws-controller-manager-77489f74b8-qs288   2/2     Running   0          8m40s

leader

kubectl -n lws-system get lease b8b2488c.x-k8s.io
####
NAME                HOLDER                                                                         AGE
b8b2488c.x-k8s.io   lws-controller-manager-77489f74b8-qs288_7f45752d-2de4-4da8-ab31-7313dc04f1ff   29m
  1. Kill the leader pod
kubectl  -n lws-system delete po lws-controller-manager-77489f74b8-qs288

The leader was changed to the other pod automatically

kubectl -n lws-system get lease b8b2488c.x-k8s.io
####
NAME                HOLDER                                                                         AGE
b8b2488c.x-k8s.io   lws-controller-manager-77489f74b8-74mwv_2d1b2863-e787-42e6-af13-71eb2a9aae9f   31m

@gujingit gujingit force-pushed the feature/leader-elect branch from 50bca89 to 8cd307b Compare June 24, 2024 03:10
@liurupeng
Copy link
Collaborator

liurupeng commented Jun 25, 2024

/lgtm
/approve

Copy link
Contributor

@kerthcet kerthcet left a comment

Choose a reason for hiding this comment

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

/hold

Should we make this the default behavior?

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 25, 2024
@liurupeng
Copy link
Collaborator

/hold

Should we make this the default behavior?

I think so, but do you know what might be the downside for that?

@kerthcet
Copy link
Contributor

Nothing special
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 25, 2024
@liurupeng
Copy link
Collaborator

/lgtm
/approve

Thanks @gujingit

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 25, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gujingit, liurupeng

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 25, 2024
@k8s-ci-robot k8s-ci-robot merged commit 034a888 into kubernetes-sigs:main Jun 25, 2024
8 checks passed
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase number of replica of the LWS controller to be deployed to cluster for better failover
4 participants