mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-19 09:38:39 +00:00
Merge pull request #93571 from ChrsMark/patch-1
Document blocking behaviour of RunOrDie and Run Kubernetes-commit: 6b963ed9c841619d511d2830719b6100d6ab1431
This commit is contained in:
commit
5d33118d47
2
Godeps/Godeps.json
generated
2
Godeps/Godeps.json
generated
@ -444,7 +444,7 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery",
|
||||
"Rev": "9254095ca5ca"
|
||||
"Rev": "1bdd76d09076"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/gengo",
|
||||
|
4
go.mod
4
go.mod
@ -27,7 +27,7 @@ require (
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
|
||||
k8s.io/api v0.0.0-20200821051526-051d027c14e1
|
||||
k8s.io/apimachinery v0.0.0-20200821051348-9254095ca5ca
|
||||
k8s.io/apimachinery v0.0.0-20200827091422-1bdd76d09076
|
||||
k8s.io/klog/v2 v2.2.0
|
||||
k8s.io/utils v0.0.0-20200729134348-d5654de09c73
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
@ -35,5 +35,5 @@ require (
|
||||
|
||||
replace (
|
||||
k8s.io/api => k8s.io/api v0.0.0-20200821051526-051d027c14e1
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200821051348-9254095ca5ca
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200827091422-1bdd76d09076
|
||||
)
|
||||
|
2
go.sum
2
go.sum
@ -334,7 +334,7 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
k8s.io/api v0.0.0-20200821051526-051d027c14e1/go.mod h1:6DKPkNII5GHfkmzU2WRXuDEJXvErpzTgkC/GRlsMFOQ=
|
||||
k8s.io/apimachinery v0.0.0-20200821051348-9254095ca5ca/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA=
|
||||
k8s.io/apimachinery v0.0.0-20200827091422-1bdd76d09076/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlmA=
|
||||
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
|
||||
k8s.io/klog/v2 v2.2.0 h1:XRvcwJozkgZ1UQJmfMGpvRthQHOvihEhYtDfAaxMz/A=
|
||||
|
@ -193,7 +193,9 @@ type LeaderElector struct {
|
||||
name string
|
||||
}
|
||||
|
||||
// Run starts the leader election loop
|
||||
// Run starts the leader election loop. Run will not return
|
||||
// before leader election loop is stopped by ctx or it has
|
||||
// stopped holding the leader lease
|
||||
func (le *LeaderElector) Run(ctx context.Context) {
|
||||
defer runtime.HandleCrash()
|
||||
defer func() {
|
||||
@ -210,7 +212,8 @@ func (le *LeaderElector) Run(ctx context.Context) {
|
||||
}
|
||||
|
||||
// RunOrDie starts a client with the provided config or panics if the config
|
||||
// fails to validate.
|
||||
// fails to validate. RunOrDie blocks until leader election loop is
|
||||
// stopped by ctx or it has stopped holding the leader lease
|
||||
func RunOrDie(ctx context.Context, lec LeaderElectionConfig) {
|
||||
le, err := NewLeaderElector(lec)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user