id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c162700
delete(d.uniqueID, epID) cancel() } d.uniqueIDMU.Unlock() }
c162701
{ return option.Config.Opts.IsEnabled(option.Debug) }
c162702
return fmt.Errorf("failed to open file %s for writing: %s", headerPath, err) } defer f.Close() fw := bufio.NewWriter(f) fmt.Fprint(fw, "/*\n") fmt.Fprintf(fw, " * XDP device: %s\n", option.Config.DevicePreFilter) fmt.Fprintf(fw, " * XDP mode: %s\n", option.Config.ModePreFilter) fmt.Fprint(fw, " */\n\n") d.pr...
c162703
createIPNet(net.IPv4len*8, net.IPv4len*8), // hosts // IPv6 createIPNet(0, net.IPv6len*8), // world createIPNet(net.IPv6len*8, net.IPv6len*8), // hosts } _, err := counter.Add(defaultPrefixes) if err != nil { log.WithError(err).Fatal("Failed to create default prefix lengths") } return count...
c162704
d.policyTrigger.Shutdown() } d.nodeDiscovery.Close() }
c162705
Reason: reason, RegenerationLevel: endpoint.RegenerateWithDatapathLoad, } return endpointmanager.RegenerateAllEndpoints(d, regenRequest), nil }
c162706
ifs { if idx := filter(intf); idx != -1 { vethLXCIdxs[idx] = intf } } return vethLXCIdxs, nil }
c162707
if found && peerIndex != 0 && strings.HasPrefix(parentVeth.Attrs().Name, "lxc") { err := netlink.LinkDel(v) if err != nil { log.WithError(err).Warningf("Unable to delete stale veth device %s", v.Attrs().Name) } } } return nil }
c162708
:= 2 if ncpu < minWorkerThreads { return minWorkerThreads } return ncpu }
c162709
range d.loadBalancer.SVCMap { list = append(list, v.GetModel()) } return list }
c162710
:= monitorAPI.AgentNotify{Type: typ, Text: text} return d.nodeMonitor.SendEvent(monitorAPI.MessageTypeAgent, event) }
c162711
{ return d.nodeMonitor.SendEvent(monitorAPI.MessageTypeAccessLog, l.LogRecord) }
c162712
} if ip == nil { log.Fatal("Node IP not available yet") } return ip.String() }
c162713
return fmt.Sprintf("apiKey=%d,apiVersion=%d,len=%d: %s", req.kind, req.version, len(req.rawMsg), string(b)) }
c162714
return fetchTopics(val) case *proto.OffsetReq: return offsetTopics(val) case *proto.MetadataReq: return metadataTopics(val) case *proto.OffsetCommitReq: return offsetCommitTopics(val) case *proto.OffsetFetchReq: return offsetFetchTopics(val) } return nil }
c162715
case *proto.OffsetFetchReq: return createOffsetFetchResponse(val, err) case nil: return nil, fmt.Errorf("unsupported request API key %d", req.kind) default: // The switch cases above must correspond exactly to the switch cases // in ReadRequest. log.Panic(fmt.Sprintf("Kafka API key not handled: %d", req.ki...
c162716
proto.OffsetCommitReqKind: req.request, err = proto.ReadOffsetCommitReq(buf) case proto.OffsetFetchReqKind: req.request, err = proto.ReadOffsetFetchReq(buf) default: log.WithField(fieldRequest, req.String()).Debugf("Unknown Kafka request API key: %d", req.kind) } if err != nil { flowdebug.Log(log.WithFiel...
c162717
n.DestPort = byteorder.HostToNetwork(n.DestPort).(uint16) return &n }
c162718
n.DestPort = byteorder.NetworkToHost(n.DestPort).(uint16) return &n }
c162719
*k.TupleKey6.ToNetwork().(*TupleKey6), } }
c162720
*k.TupleKey6.ToHost().(*TupleKey6), } }
c162721
nodeAddressing: NewNodeAddressing(), config: config, } dp.node = NewNodeHandler(config, dp.nodeAddressing) return dp }
c162722
i.SetAggregatedSelectors() } return i.aggregatedSelectors }
c162723
len(i.FromRequires)+len(i.FromCIDR)+len(i.FromCIDRSet) == 0 }
c162724
client timeout exceeded") default: return err } }
c162725
:= e.session.Lease() e.RWMutex.RUnlock() return l }
c162726
orphan. if e.session.Lease() == leaseID { e.session.Orphan() } e.RWMutex.RUnlock() }
c162727
<-e.firstSession e.RLock() ch := e.session.Done() e.RUnlock() return ch }
c162728
} e.getLogger().WithFields(logrus.Fields{ fieldEtcdEndpoint: ep, "version": v, }).Info("Successfully verified version of etcd endpoint") } if len(eps) == 0 { e.getLogger().Warn("Minimal etcd version unknown: No etcd endpoints available") } return nil }
c162729
increaseMetric(key, metricSet, "Update", duration.EndError(err).Total(), err) return Hint(err) } duration := spanstat.Start() e.limiter.Wait(ctx) _, err := e.client.Put(ctx, key, string(value)) increaseMetric(key, metricSet, "Update", duration.EndError(err).Total(), err) return Hint(err) }
c162730
e.RLock() defer e.RUnlock() e.session.Close() e.client.Close() }
c162731
e.getLogger().WithField(fieldWatcher, w).Debug("Starting watcher...") go e.Watch(w) return w }
c162732
bm := newEtcdModule() err := bm.setConfig(opts) if err != nil { return false } etcdConfig := bm.getConfig()[EtcdOptionConfig] if len(etcdConfig) == 0 { return false } cfg, err := clientyaml.NewConfig(etcdConfig) if err != nil { log.WithError(err).Error("Unable to read etcd configuration.") return fals...
c162733
*GetPolicyResolveOK { o.Payload = payload return o }
c162734
case l.Type == accesslog.TypeRequest: fmt.Printf(" DNS Query: %s %s", l.DNS.Query, qTypeStr) case l.Type == accesslog.TypeResponse: sourceType := "Query" if l.DNS.ObservationSource == accesslog.DNSSourceAgentPoller { sourceType = "Poll" } fmt.Printf(" DNS %s: %s %s", sourceType, l.DNS.Query, q...
c162735
n.DestinationEndpoint.Labels, DstIdentity: n.DestinationEndpoint.Identity, Verdict: n.Verdict, HTTP: n.HTTP, Kafka: n.Kafka, DNS: n.DNS, L7: n.L7, } }
c162736
int64) *DeleteEndpointIDErrors { o.Payload = payload return o }
c162737
models.Error) *DeleteEndpointIDInvalid { o.Payload = payload return o }
c162738
*Allocator) { a.min = id } }
c162739
*Allocator) { a.max = id } }
c162740
*Allocator) { a.prefixMask = mask } }
c162741
if a.events != nil { close(a.events) } }
c162742
case <-ctx.Done(): return fmt.Errorf("identity sync with kvstore was cancelled: %s", ctx.Err()) } return nil }
c162743
{ suffix := strings.TrimPrefix(key, a.basePrefix) return kvstore.LockPath(ctx, path.Join(a.lockPrefix, suffix)) }
c162744
for rc := range a.remoteCaches { rc.cache.foreach(cb) } a.remoteCachesMutex.RUnlock() }
c162745
id |= a.prefixMask return id, id.String(), unmaskedID } return 0, "", 0 }
c162746
if err == nil { a.mainCache.insert(key, value) return value, isNew, nil } scopedLog := log.WithFields(logrus.Fields{ fieldKey: key, logfields.Attempt: attempt, }) select { case <-ctx.Done(): scopedLog.WithError(ctx.Err()).Warning("Ongoing key allocation has been cancelled") retur...
c162747
{ if id := a.mainCache.get(key.GetKey()); id != idpool.NoID { return id, nil } return a.GetNoCache(ctx, key) }
c162748
prefix) kvstore.Trace("AllocateGet", err, logrus.Fields{fieldPrefix: prefix, fieldKey: k, fieldValue: v}) if err != nil || v == nil || !prefixMatchesKey(prefix, k) { return 0, err } id, err := strconv.ParseUint(string(v), 10, 64) if err != nil { return idpool.NoID, fmt.Errorf("unable to parse value '%s': %s"...
c162749
{ return key, nil } v, err := kvstore.Get(path.Join(a.idPrefix, id.String())) if err != nil { return nil, err } return a.keyType.PutKey(string(v)) }
c162750
valueKey := path.Join(a.valuePrefix, k, a.suffix) if err := kvstore.Delete(valueKey); err != nil { log.WithError(err).WithFields(logrus.Fields{fieldKey: key}).Warning("Ignoring node specific ID") } // if a.lockless { // FIXME: etcd 3.3 will make it possible to do a lockless // cleanup of the ID and rel...
c162751
// fetch list of all /value/<key> keys valueKeyPrefix := path.Join(a.valuePrefix, string(v)) uses, err := kvstore.ListPrefix(valueKeyPrefix) if err != nil { log.WithError(err).WithField(fieldPrefix, valueKeyPrefix).Warning("allocator garbage collector was unable to list keys") lock.Unlock() continue ...
c162752
the sync but that is fine as worst case, // a master key is created for a slave key that no longer exists. The // garbage collector will remove it again. ids := a.localKeys.getVerifiedIDs() for id, value := range ids { a.recreateMasterKey(id, value, false) } return nil }
c162753
rc.allocator.remoteCachesMutex.Unlock() rc.cache.stop() }
c162754
subnet we are allowing. if allowCIDR.Contains(remove.IP.Mask(remove.Mask)) { nets, err := removeCIDR(allowCIDR, remove) if err != nil { return nil, err } // Remove CIDR that we have just processed and append new CIDRs // that we computed from removing the CIDR to remove. allowCIDRs = a...
c162755
if ipU64 == 0 { ipU64 = binary.BigEndian.Uint64(ip[:net.IPv6len/2]) ipU64++ binary.BigEndian.PutUint64(nextIP[:net.IPv6len/2], ipU64) } else { copy(nextIP[:net.IPv6len/2], ip[:net.IPv6len/2]) } return nextIP default: return ip } }
c162756
bitLen = ipv6BitLen } _, _, right := partitionCIDR(spanningCIDR, net.IPNet{IP: prevFirstRangeIP, Mask: net.CIDRMask(bitLen, bitLen)}) // Append all CIDRs but the first, as this CIDR includes the upper // bound of the spanning CIDR, which we still need to partition on. cidrList = append(cidrList, right...) ...
c162757
if block.Contains(ip) { return false } } return true }
c162758
if err := node.SetIPv6NodeRange(n.IPv6AllocCIDR.IPNet); err != nil { log.WithError(err).WithFields(logrus.Fields{ logfields.Node: n.Name, logfields.V6Prefix: n.IPv6AllocCIDR, }).Warn("k8s: Can't use IPv6 CIDR range from k8s") } } }
c162759
p.idCache = newIDCache(p.minID, p.maxID) return p }
c162760
return p.idCache.leaseAvailableID() }
c162761
p.mutex.Unlock() return p.idCache.use(id) }
c162762
p.mutex.Unlock() return p.idCache.insert(id) }
c162763
p.mutex.Unlock() return p.idCache.remove(id) }
c162764
delete(c.ids, id) return id } return NoID }
c162765
if id == NoID { return NoID } // Mark as leased c.leased[id] = struct{}{} return id }
c162766
delete(c.leased, id) c.insert(id) return true }
c162767
c.leased[id]; !exists { return false } delete(c.leased, id) return true }
c162768
c.leased[id]; exists { return false } c.ids[id] = struct{}{} return true }
c162769
delete(c.ids, id) return true } return false }
c162770
endpoint is in the process of being removed") } return nil }
c162771
e.mutex.RUnlock() return ErrNotAlive } return nil }
c162772
e.getLogger().WithError(err).Error(context) }
c162773
out := new(ClusterService) in.DeepCopyInto(out) return out }
c162774
nil } l.bumpNextNumericIdentity() if l.nextNumericIdentity == firstID { return 0, fmt.Errorf("out of local identity space") } } }
c162775
delete(l.identitiesByLabels, stringRepresentation) delete(l.identitiesByID, id.ID) if l.events != nil { l.events <- allocator.AllocatorEvent{ Typ: kvstore.EventTypeDelete, ID: idpool.ID(id.ID), } } return true } } return false }
c162776
:= l.identitiesByLabels[stringRepresentation]; ok { return id } return nil }
c162777
id, ok := l.identitiesByID[id]; ok { return id } return nil }
c162778
defer l.mutex.RUnlock() for key, id := range l.identitiesByID { cache[key] = id } return cache }
c162779
!= nil { return nil, fmt.Errorf( "Cannot retrieve data from %s provider: %s", AWSProvider, err) } ips = append(ips, awsIPs...) } resultIps := ip.KeepUniqueIPs(ips) return IPsToCIDRRules(resultIps), nil }
c162780
*GetDebuginfoOK { o.Payload = payload return o }
c162781
models.Error) *GetDebuginfoFailure { o.Payload = payload return o }
c162782
time.Duration) *GetPolicyParams { o.SetTimeout(timeout) return o }
c162783
*GetPolicyParams { o.SetContext(ctx) return o }
c162784
o.SetHTTPClient(client) return o }
c162785
o.SetLabels(labels) return o }
c162786
time.Duration) *PatchEndpointIDParams { o.SetTimeout(timeout) return o }
c162787
*PatchEndpointIDParams { o.SetContext(ctx) return o }
c162788
{ o.SetHTTPClient(client) return o }
c162789
*PatchEndpointIDParams { o.SetEndpoint(endpoint) return o }
c162790
string) *PatchEndpointIDParams { o.SetID(id) return o }
c162791
&& !os.IsNotExist(err) { scopedLog.WithError(err).Warning("Failed to remove pidfile") } }
c162792
return write(path, pid) }
c162793
// a low level and ignore the error. log.WithFields(logrus.Fields{ logfields.PID: pid, logfields.PIDFile: pidfile, }).Info("Killing old process") if err := oldProc.Kill(); err != nil { log.WithError(err).Debug("Ignoring process kill failure") } if err := oldProc.Release(); err != nil { return fmt.Err...
c162794
err := kill(pidfile, pidfilePath); err != nil { return err } return os.RemoveAll(pidfilePath) }
c162795
&GetFqdnCache{Context: ctx, Handler: handler} }
c162796
pieces = append(pieces, strconv.Itoa(int(v))) } return strings.Join(pieces, ", ") }
c162797
err } *i = append(*i, uint16(v)) return nil }
c162798
c.LastRxReport, c.TxPackets, c.TxBytes, c.TxFlagsSeen, c.LastTxReport, c.Flags, byteorder.NetworkToHost(c.RevNAT), c.Slave, c.SourceSecurityID) }
c162799
make(chan struct{}), } go cc.garbageCollector() return cc }