mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/kube-vip/kube-vip.git
synced 2026-09-20 08:03:47 +08:00
fix: logrus required by our test-cases, now only transient because of containerd (#1694)
* fix: logrus required by our test-cases, now only transient because of containerd Signed-off-by: Marcel Fest <marcel.fest@telekom.de> * fix: duplicate log module Signed-off-by: Marcel Fest <marcel.fest@telekom.de> * fix(race): between service cancelling lease and lease cancelling service Signed-off-by: Marcel Fest <marcel.fest@telekom.de> * fix(race): again Signed-off-by: Marcel Fest <marcel.fest@telekom.de> --------- Signed-off-by: Marcel Fest <marcel.fest@telekom.de>
This commit is contained in:
@@ -196,9 +196,9 @@ func (p *Processor) AddOrModify(ctx context.Context, event watch.Event, serviceF
|
||||
}
|
||||
// in theory this should never fail
|
||||
p.svcMap.Delete(svc.UID)
|
||||
// Drop this service from its lease now, so the replacement context
|
||||
// below is not parented to a lease the pending cleanup is about to
|
||||
// cancel. A lease shared with other services stays alive for them.
|
||||
// Retire the lease before the replacement context is built, so Add below
|
||||
// cannot hand back an instance the pending cleanup is about to cancel.
|
||||
// A lease shared with other services keeps their references and survives.
|
||||
ns, name := lease.ServiceName(svc)
|
||||
leaseID := lease.NewID(p.config.LeaderElectionType, ns, name)
|
||||
p.leaseMgr.Delete(leaseID, lease.ServiceNamespacedName(svc), nil)
|
||||
@@ -216,8 +216,10 @@ func (p *Processor) AddOrModify(ctx context.Context, event watch.Event, serviceF
|
||||
if svcCtx == nil {
|
||||
ns, name := lease.ServiceName(svc)
|
||||
leaseID := lease.NewID(p.config.LeaderElectionType, ns, name)
|
||||
lease := p.leaseMgr.Add(ctx, leaseID)
|
||||
svcCtx = servicecontext.New(lease.Ctx)
|
||||
p.leaseMgr.Add(ctx, leaseID)
|
||||
// The service context is parented to the watcher, not to the lease: losing a
|
||||
// lease must not tear the service down, it has to let the election restart.
|
||||
svcCtx = servicecontext.New(ctx)
|
||||
p.svcMap.Store(svc.UID, svcCtx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user