本文整理汇总了Golang中github.com/coreos/flannel/subnet.LeaseRenewer函数的典型用法代码示例。如果您正苦于以下问题:Golang LeaseRenewer函数的具体用法?Golang LeaseRenewer怎么用?Golang LeaseRenewer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LeaseRenewer函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Run
func (rb *HostgwBackend) Run() {
rb.wg.Add(1)
go func() {
subnet.LeaseRenewer(rb.ctx, rb.sm, rb.network, rb.lease)
rb.wg.Done()
}()
log.Info("Watching for new subnet leases")
evts := make(chan []subnet.Event)
rb.wg.Add(1)
go func() {
subnet.WatchLeases(rb.ctx, rb.sm, rb.network, rb.lease, evts)
rb.wg.Done()
}()
rb.rl = make([]netlink.Route, 0, 10)
rb.wg.Add(1)
go func() {
rb.routeCheck(rb.ctx)
rb.wg.Done()
}()
defer rb.wg.Wait()
for {
select {
case evtBatch := <-evts:
rb.handleSubnetEvents(evtBatch)
case <-rb.ctx.Done():
return
}
}
}
开发者ID:rajatchopra,项目名称:flannel,代码行数:34,代码来源:hostgw.go
示例2: Run
func (vb *VXLANBackend) Run() {
vb.wg.Add(1)
go func() {
subnet.LeaseRenewer(vb.ctx, vb.sm, vb.network, vb.lease)
log.Info("LeaseRenewer exited")
vb.wg.Done()
}()
log.Info("Watching for L3 misses")
misses := make(chan *netlink.Neigh, 100)
// Unfrtunately MonitorMisses does not take a cancel channel
// as there's no wait to interrupt netlink socket recv
go vb.dev.MonitorMisses(misses)
log.Info("Watching for new subnet leases")
evts := make(chan []subnet.Event)
vb.wg.Add(1)
go func() {
subnet.WatchLeases(vb.ctx, vb.sm, vb.network, vb.lease, evts)
log.Info("WatchLeases exited")
vb.wg.Done()
}()
defer vb.wg.Wait()
initialEvtsBatch := <-evts
for {
err := vb.handleInitialSubnetEvents(initialEvtsBatch)
if err == nil {
break
}
log.Error(err, " About to retry")
time.Sleep(time.Second)
}
for {
select {
case miss := <-misses:
vb.handleMiss(miss)
case evtBatch := <-evts:
vb.handleSubnetEvents(evtBatch)
case <-vb.ctx.Done():
return
}
}
}
开发者ID:rajatchopra,项目名称:flannel,代码行数:47,代码来源:vxlan.go
示例3: Run
func (n *Network) Run(ctx context.Context) {
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
n.be.Run(ctx)
wg.Done()
}()
wg.Add(1)
go func() {
subnet.LeaseRenewer(ctx, n.sm, n.Name, n.lease)
wg.Done()
}()
<-ctx.Done()
wg.Wait()
}
开发者ID:OpenSorceress,项目名称:flannel,代码行数:17,代码来源:network.go
示例4: Run
func (n *Network) Run(extIface *backend.ExternalInterface, inited func(bn backend.Network)) {
wg := sync.WaitGroup{}
For:
for {
err := n.init()
switch err {
case nil:
break For
case context.Canceled:
return
default:
log.Error(err)
select {
case <-n.ctx.Done():
return
case <-time.After(time.Second):
}
}
}
inited(n.bn)
wg.Add(1)
go func() {
n.bn.Run(n.ctx)
wg.Done()
}()
wg.Add(1)
go func() {
subnet.LeaseRenewer(n.ctx, n.sm, n.Name, n.bn.Lease())
wg.Done()
}()
defer func() {
if n.ipMasq {
if err := teardownIPMasq(n.Config.Network); err != nil {
log.Errorf("Failed to tear down IP Masquerade for network %v: %v", n.Name, err)
}
}
}()
wg.Wait()
}
开发者ID:jonboulle,项目名称:flannel,代码行数:45,代码来源:network.go
示例5: Run
func (m *UdpBackend) Run() {
// one for each goroutine below
m.wg.Add(2)
go func() {
runCProxy(m.tun, m.conn, m.ctl2, m.tunNet.IP, m.mtu)
m.wg.Done()
}()
go func() {
subnet.LeaseRenewer(m.ctx, m.sm, m.network, m.lease)
m.wg.Done()
}()
m.monitorEvents()
m.wg.Wait()
}
开发者ID:rajatchopra,项目名称:flannel,代码行数:18,代码来源:udp.go
示例6: Run
func (n *Network) Run() {
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
n.be.Run(n.ctx)
wg.Done()
}()
wg.Add(1)
go func() {
subnet.LeaseRenewer(n.ctx, n.sm, n.Name, n.lease)
wg.Done()
}()
<-n.ctx.Done()
n.be.UnregisterNetwork(n.ctx, n.Name)
wg.Wait()
}
开发者ID:patrobinson,项目名称:flannel,代码行数:19,代码来源:network.go
示例7: Run
func (m *AwsVpcBackend) Run() {
subnet.LeaseRenewer(m.ctx, m.sm, m.network, m.lease)
}
开发者ID:nathanleiby,项目名称:flannel,代码行数:3,代码来源:awsvpc.go
示例8: Run
func (g *GCEBackend) Run() {
log.Info("GCE backend running")
subnet.LeaseRenewer(g.ctx, g.sm, g.network, g.lease)
}
开发者ID:MarkBruns,项目名称:flannel,代码行数:4,代码来源:gce.go
注:本文中的github.com/coreos/flannel/subnet.LeaseRenewer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论