Commit Graph

30 Commits

Author SHA1 Message Date
Roy Lenferink
94093d2527 Updated OWNERS files to include link to docs
Kubernetes-commit: b43c04452f3b563473b5c2a765d4ac18cc0ff58f
2019-01-30 20:05:00 +01:00
Matthew Wong
e10ef5817f Add Lease implementation to leaderelection package
Kubernetes-commit: 410175851c092dae63f72f7d12abf19b1b74e200
2018-11-20 10:29:44 -05:00
Clayton Coleman
77dfa9569a Add transport wrapper that blocks api calls after context close
The ContextCanceller transport wrapper blocks all API requests
after the provided context is closed. Used with the leader election
step down, a controller can ensure that new requests are not made
after the client has stepped down.

Kubernetes-commit: fe74efb1f90826b1903d2908ff9e528329bebea0
2018-12-27 12:29:34 -05:00
Clayton Coleman
30b06a83d6 leaderelection: Allow leader elected code to step down on a context cancel
The current code simply exits without continuing to renew the lease, which means
participants using a slower lease duration might have to wait multiple minutes
before a new leader is elected. Allow an optional flag to be set on
LeaderElectionConfig that will release the lease when the calling context is
cancelled. Callers *must* ensure their lease guarded code has completed before
the context is cancelled, or other processes may acquire the lease before this
lease has released.

Add an example command that demonstrates how cancellation could be done.

As a convenience to users, make event recorder optional - not all users of the
lock code will need a recorder.

Kubernetes-commit: 09890b6c48da8e85237a5674d6256900f482b0a5
2018-11-27 21:51:21 -05:00
Walter Fender
03e373bae2 Add gauge metric for master of leader election.
Fixes #71730
0 indicates standby, 1 indicates master, label indicates which lease.
Tweaked name and documentation
Factored in Mike Danese feedback.
Removed dependency on prometheus from client-go using adapter.
Centralized adapter import.
Fixed godeps
Fixed boilerplate.
Put in fixes for caesarxuchao

Kubernetes-commit: f1926573804ed2c172c91d1022203d0699210138
2018-12-04 18:20:11 -08:00
Walter Fender
f0a328366e Report KCM as unhealthy if leader election is wedged.
Feedback from lavalamp and deads2k.
Changed Check() logic to be central to LeaderElector.
Further changes, especially cleaning up the test code.

Kubernetes-commit: 9c43ee6d6ec6a159b960381af906c130027bc716
2018-11-12 18:45:21 -08:00
Davanum Srinivas
74cd8bbeee Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135

Kubernetes-commit: 954996e231074dc7429f7be1256a579bedd8344c
2018-11-09 13:49:10 -05:00
seunghunee
74d0afcfd9 leaderelection: reduce renewed lease verbosity
This patch changes the renewed lease log level from 4 to 5 of leaderelection.go

Fix: #69743

Kubernetes-commit: 920db78bea84d4bb015970547cda5a1df4f79a04
2018-11-01 08:12:07 +00:00
tanshanshan
9a73dd2136 fix error info
Kubernetes-commit: 19c9df95ad7812f3f5bab39211c82316e72f91b4
2018-09-04 17:14:12 +08:00
xuzhonghu
1ca2f836dc bug fix: dead loop leaderelection
Kubernetes-commit: 7a2c5794097dba18a3bf9e170e8c0b2ff4a916d7
2018-07-02 15:49:39 +08:00
xuzhonghu
57f617c0b1 leaderelection: set timeout for tryAcquireOrRenew
Kubernetes-commit: 90b287c12d921e4e08e522dbe214f5587f147956
2018-06-20 15:44:31 +08:00
zhengjiajin
7d6d732419 enhance leaderelection code
Kubernetes-commit: 9fe2a5a430055657186491c23e85cc489e401bc7
2018-05-11 13:29:41 +08:00
Mikhail Mazurskiy
f674595347 Use context.TODO() to be explicit that cancellation is not implemented
Kubernetes-commit: 102090d1f12f9b00571d440470ba040e0632fbe0
2018-06-07 14:33:03 +10:00
Mikhail Mazurskiy
ad39df114e Cancellable leader election with context
Kubernetes-commit: dc32a341c01ec122f54604e9fdbdf9b77d2e19e3
2018-02-12 21:02:56 +11:00
Mikhail Mazurskiy
79cc4033c7 Cancellable leader election with channels
Kubernetes-commit: 1d99fff1acb1503755b94d4c72e6dedd35c2d249
2018-02-12 20:48:53 +11:00
David Eads
1088d9ef09 prevent zero for leader election timeouts
Kubernetes-commit: 7288e8828f5bf659d41e71760f9d9923e405e2e4
2018-05-23 15:00:37 -04:00
Kubernetes Publisher
fff8c3d73e sync: initially remove files BUILD */BUILD BUILD.bazel */BUILD.bazel 2018-03-15 09:19:38 +00:00
Matt Kelly
ae2f680955 Fix typos in configmaplock
Kubernetes-commit: b2342ae9d942af2f6bf572aeb71cce6acaac218b
2018-02-19 14:40:11 -05:00
Jeff Grafton
fca8bb2928 Autogenerated: hack/update-bazel.sh
Kubernetes-commit: ef56a8d6bb3800ab7803713eafc4191e8202ad6e
2018-02-16 13:43:01 -08:00
Di Xu
d39d12f4b0 fix all the typos across the project
Kubernetes-commit: 48388fec7eaad4ac8d84fbe20673ffacf41964a1
2018-02-09 14:53:53 +08:00
David Eads
5fecd3df89 say which lease is being acquired
Kubernetes-commit: 5b854e7b17d68e191b74501afb72fc5fb9582e1b
2018-01-16 11:00:43 -05:00
Jeff Grafton
fe985a55a2 Autogenerate BUILD files
Kubernetes-commit: efee0704c60a2ee3049268a41535aaee7f661f6c
2017-12-23 13:06:26 -08:00
Jeff Grafton
c92755ea3b update BUILD files
Kubernetes-commit: aee5f457dbfd70c2d15c33e392dce6a3ca710116
2017-10-12 13:52:10 -07:00
Jeff Grafton
5da217e5c4 Use buildozer to delete licenses() rules except under third_party/
Kubernetes-commit: a7f49c906df816123e7d4ccbd4cebab411519465
2017-08-29 12:51:55 +00:00
Jeff Grafton
fa2ceb7462 Use buildozer to remove deprecated automanaged tags
Kubernetes-commit: 33276f06be5e872bf53ca62a095fcf0a6b6c11a8
2017-08-29 12:51:55 +00:00
Jeff Grafton
f921a73942 Run hack/update-bazel.sh to generate BUILD files
Kubernetes-commit: 3579017b865ddbc5449d6bba87346f086e4b93ff
2017-08-29 12:50:17 +00:00
Clayton Coleman
684e17ef90 Use a client interface instead of a concrete type
Aids testing

Kubernetes-commit: b9bebe8a4e12648a68ed02036ff8d4a7ec9be2eb
2017-07-28 13:45:49 +00:00
liaoyw
0e9b63a3bb Log error when failed to renew lease.
Kubernetes-commit: 8c120dcf2f8c97da8143d36f26746c4f4685b828
2017-07-19 03:39:07 +00:00
Chao Xu
ec4003cdb5 update bazel
Kubernetes-commit: 65cedeeb433638a977ad8d1be9870c2567671f04
2017-07-16 03:58:42 +00:00
Chao Xu
9869cc1684 move leaderelection package to client-go
Kubernetes-commit: 24d5279c59f1285fa8f589599d937ebee24f7ea4
2017-07-16 03:58:42 +00:00