id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c163500 | make(IntCounter),
maxUniquePrefixes4: maxUniquePrefixes4,
maxUniquePrefixes6: maxUniquePrefixes6,
}
} | |
c163501 | (current: %d, result: %d, max: %d)",
current, newCount, max)
}
return nil
} | |
c163502 | }
case net.IPv6len * 8:
if newV6Counter.Add(ones) {
newV6Prefixes = true
}
default:
return false, fmt.Errorf("Unsupported IPAddr bitlength %d", bits)
}
}
// Check if they can be added given the limit in place
if newV4Prefixes {
if err := checkLimits(len(p.v4), len(newV4Counter), p.maxUniquePre... | |
c163503 | p.v4.Delete(ones) {
changed = true
}
case net.IPv6len * 8:
if p.v6.Delete(ones) {
changed = true
}
}
}
return changed
} | |
c163504 | {
p.RLock()
defer p.RUnlock()
return p.v6.ToBPFData(), p.v4.ToBPFData()
} | |
c163505 | time.Duration) *GetFqdnCacheIDParams {
o.SetTimeout(timeout)
return o
} | |
c163506 | *GetFqdnCacheIDParams {
o.SetContext(ctx)
return o
} | |
c163507 | {
o.SetHTTPClient(client)
return o
} | |
c163508 | *string) *GetFqdnCacheIDParams {
o.SetCidr(cidr)
return o
} | |
c163509 | string) *GetFqdnCacheIDParams {
o.SetID(id)
return o
} | |
c163510 | o.SetMatchpattern(matchpattern)
return o
} | |
c163511 | api.WriteTxnMarkersKey,
api.TxnOffsetCommitKey,
api.AlterReplicaLogDirsKey,
api.DescribeLogDirsKey,
api.CreatePartitionsKey:
return true
}
return false
} | |
c163512 |
if req.ruleMatches(rule) {
return true
}
} else if reqTopicsMap[rule.Topic] {
if req.ruleMatches(rule) {
delete(reqTopicsMap, rule.Topic)
if len(reqTopicsMap) == 0 {
return true
}
}
}
}
return false
} | |
c163513 | nil {
return api.Error(PatchEndpointIDInvalidCode, err)
}
if err := ep.Update(d, cfg); err != nil {
switch err.(type) {
case endpoint.UpdateValidationError:
return api.Error(PatchEndpointIDConfigInvalidCode, err)
default:
return api.Error(PatchEndpointIDConfigFailedCode, err)
}
}
if err := ep.RLoc... | |
c163514 | *GetEndpointIDLabelsOK {
o.Payload = payload
return o
} | |
c163515 | time.Duration) *PatchEndpointIDLabelsParams {
o.SetTimeout(timeout)
return o
} | |
c163516 | context.Context) *PatchEndpointIDLabelsParams {
o.SetContext(ctx)
return o
} | |
c163517 | *http.Client) *PatchEndpointIDLabelsParams {
o.SetHTTPClient(client)
return o
} | |
c163518 | *PatchEndpointIDLabelsParams {
o.SetConfiguration(configuration)
return o
} | |
c163519 | string) *PatchEndpointIDLabelsParams {
o.SetID(id)
return o
} | |
c163520 | err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | |
c163521 | }
yamlLabels = append(yamlLabels, labels.GenerateK8sLabelString(k8sConst.PodNamespaceLabel, ns))
for k, v := range controller.Spec.Template.Labels {
yamlLabels = append(yamlLabels, labels.GenerateK8sLabelString(k, v))
}
case *v1beta1.ReplicaSet:
rep := obj.(*v1beta1.ReplicaSet)
var ns string
i... | |
c163522 | brokenSHA
}
template, err := os.Readlink(templateSymlink)
if err != nil {
return brokenSHA
}
if f, err = os.Stat(template); err != nil {
return brokenSHA
}
return filepath.Base(filepath.Dir(template))
} | |
c163523 |
if err := ipam.IPv6Allocator.Allocate(ip); err != nil {
return err
}
}
log.WithFields(logrus.Fields{
"ip": ip.String(),
"owner": owner,
}).Debugf("Allocated specific IP")
ipam.owner[ip.String()] = owner
metrics.IpamEvent.WithLabelValues(metricAllocate, family).Inc()
return nil
} | |
c163524 | fmt.Errorf("Invalid IP address: %s", ipAddr)
}
return ipam.AllocateIP(ip, owner)
} | |
c163525 | = ipam.allocateNextFamily(family, ipam.IPv4Allocator, owner)
default:
err = fmt.Errorf("unknown address \"%s\" family requested", family)
}
return
} | |
c163526 | if err != nil {
return
}
}
if (family == "ipv4" || family == "") && ipam.IPv4Allocator != nil {
ipv4, err = ipam.AllocateNextFamily(IPv4, owner)
if err != nil {
if ipv6 != nil {
ipam.ReleaseIP(ipv6)
}
return
}
}
return
} | |
c163527 | != nil {
return err
}
}
owner := ipam.owner[ip.String()]
log.WithFields(logrus.Fields{
"ip": ip.String(),
"owner": owner,
}).Debugf("Released IP")
delete(ipam.owner, ip.String())
metrics.IpamEvent.WithLabelValues(metricRelease, family).Inc()
return nil
} | |
c163528 | fmt.Errorf("Invalid IP address: %s", ipAddr)
}
return ipam.ReleaseIP(ip)
} | |
c163529 | owner, _ := ipam.owner[ip]
// If owner is not available, report IP but leave owner empty
allocv4[ip] = owner
}
}
}
allocv6 := map[string]string{}
ralv6 := k8sAPI.RangeAllocation{}
if ipam.IPv6Allocator != nil {
ipam.IPv6Allocator.Snapshot(&ralv6)
origIP := big.NewInt(0).SetBytes(ipam.nodeAddress... | |
c163530 |
if success {
s.successDuration += d
} else {
s.failureDuration += d
}
}
s.spanStart = time.Time{}
return s
} | |
c163531 | := new(SlimCNP)
in.DeepCopyInto(out)
return out
} | |
c163532 |
return NewFilteredCiliumNetworkPolicyInformer(client, namespace, resyncPeriod, indexers, nil)
} | |
c163533 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.CiliumV2().CiliumNetworkPolicies(namespace).Watch(options)
},
},
&ciliumiov2.CiliumNetworkPolicy{},
resyncPeriod,
indexers,
)
} | |
c163534 | err := module.setConfig(opts); err != nil {
errChan <- err
return nil, errChan
}
if err := module.setExtraConfig(options); err != nil {
errChan <- err
return nil, errChan
}
return module.newClient(options)
} | |
c163535 | }
for _, r := range rules {
if ruleMatches := r.matches(securityIdentity); ruleMatches {
epIDSet.Mutex.Lock()
epIDSet.IDs[id] = struct{}{}
epIDSet.Mutex.Unlock()
// If epIDSet is updated, we can exit since updating it again if
// another rule selects the Endpoint is a no-op.
return true, nil
}... | |
c163536 | cilium.RegisterNetworkPolicyHostsDiscoveryServiceServer(grpcServer, dsServer)
reflection.Register(grpcServer)
go func() {
log.Infof("Envoy: Starting xDS gRPC server listening on %s", listener.Addr())
if err := grpcServer.Serve(listener); err != nil && !strings.Contains(err.Error(), "closed network connection")... | |
c163537 | ret != 0 || err != 0 {
return fmt.Errorf("Unable to delete element from map with file descriptor %d: %s", fd, err)
}
return nil
} | |
c163538 | metricSyscallDuration.WithLabelValues(metricOpObjPin, metrics.Errno2Outcome(err)).Observe(duration.End(err == 0).Total().Seconds())
if ret != 0 || err != 0 {
return fmt.Errorf("Unable to pin object with file descriptor %d to %s: %s", fd, pathname, err)
}
return nil
} | |
c163539 | unix.SYS_BPF,
BPF_OBJ_GET,
uintptr(unsafe.Pointer(&uba)),
unsafe.Sizeof(uba),
)
metricSyscallDuration.WithLabelValues(metricOpObjGet, metrics.Errno2Outcome(err)).Observe(duration.End(err == 0).Total().Seconds())
if fd == 0 || err != 0 {
return 0, &os.PathError{
Op: "Unable to get object",
Err: er... | |
c163540 |
unsafe.Sizeof(uba),
)
metricSyscallDuration.WithLabelValues(metricOpGetFDByID, metrics.Errno2Outcome(err)).Observe(duration.End(err == 0).Total().Seconds())
if fd == 0 || err != 0 {
return 0, fmt.Errorf("Unable to get object fd from id %d: %s", id, err)
}
return int(fd), nil
} | |
c163541 | &GetEndpointIDConfig{Context: ctx, Handler: handler}
} | |
c163542 | != other.Protocol {
return p.Protocol == "" || p.Protocol == ProtoAny
}
return true
} | |
c163543 | 0
}
return len(rules.HTTP) + len(rules.Kafka) + len(rules.DNS) + len(rules.L7)
} | |
c163544 | || (rules.HTTP == nil && rules.Kafka == nil && rules.DNS == nil && rules.L7 == nil)
} | |
c163545 | p.computeDirectionL4PolicyMapEntries(identityCache, p.L4Policy.Egress, trafficdirection.Egress, p.DeniedEgressIdentities)
return
} | |
c163546 | Type: r.Type,
}
if r.Nexthop != nil {
rt.Gw = *r.Nexthop
}
if r.Scope != netlink.SCOPE_UNIVERSE {
rt.Scope = r.Scope
} else if r.Scope == netlink.SCOPE_UNIVERSE && r.Type == RTN_LOCAL {
rt.Scope = netlink.SCOPE_HOST
}
return rt
} | |
c163547 | net.CIDRMask(32, 32)}
}
return &net.IPNet{IP: *r.Nexthop, Mask: net.CIDRMask(128, 128)}
} | |
c163548 | link.Attrs().Name,
MTU: nlRoute.MTU,
Scope: nlRoute.Scope,
Nexthop: &nlRoute.Gw,
}
if nlRoute.Dst != nil {
result.Prefix = *nlRoute.Dst
}
return result, nil
} | |
c163549 | {
return false, fmt.Errorf("unable to add L2 nexthop route: %s", err)
}
return true, nil
} | |
c163550 | specified for IPv4
if route.Prefix.IP.To4() != nil {
routeSpec.Scope = route.Scope
}
if err := netlink.RouteDel(&routeSpec); err != nil {
return err
}
return nil
} | |
c163551 |
return nil
}
return replaceRule(fwmark, table, netlink.FAMILY_V4)
} | |
c163552 |
return nil
}
return replaceRule(fwmark, table, netlink.FAMILY_V6)
} | |
c163553 |
rule.Mask = linux_defaults.RouteMarkMask
rule.Table = table
rule.Family = netlink.FAMILY_V4
return netlink.RuleDel(rule)
} | |
c163554 | rule.Family = netlink.FAMILY_V6
return netlink.RuleDel(rule)
} | |
c163555 | &PutStatusProbe{Context: ctx, Handler: handler}
} | |
c163556 | "invalid module info - it has %d fields (less than 6): %s",
len(moduleInfoSeparated), moduleInfoRaw)
}
result = append(result, moduleInfoSeparated[0])
}
return result, nil
} | |
c163557 | if e != nil {
e.LogStatus(endpoint.BPF, endpoint.Warning, fmt.Sprintf("%s: %s", msg, err))
}
continue
}
defer m.Close()
mapType = m.MapInfo.MapType
deleted := ctmap.GC(m, filter)
if deleted > 0 {
log.WithFields(logrus.Fields{
logfields.Path: path,
"count": deleted,
}).Debug... | |
c163558 | initialScan = false
}
time.Sleep(calculateInterval(mapType))
}
}()
select {
case <-initialScanComplete:
log.Info("Initial scan of connection tracking completed")
case <-time.After(30 * time.Second):
log.Fatal("Timeout while waiting for initial conntrack scan")
}
} | |
c163559 | &GetServiceID{Context: ctx, Handler: handler}
} | |
c163560 |
return s[i].ID < s[j].ID
} | |
c163561 | }
})
}
for key, identity := range identity.ReservedIdentityCache {
cache[key] = identity.Labels.LabelArray()
}
if localIdentities != nil {
for _, identity := range localIdentities.GetIdentities() {
cache[identity.ID] = identity.Labels.LabelArray()
}
}
return cache
} | |
c163562 | reserved identities
for _, v := range identity.ReservedIdentityCache {
identities = append(identities, v.GetModel())
}
for _, v := range localIdentities.GetIdentities() {
identities = append(identities, v.GetModel())
}
return identities
} | |
c163563 |
}
// Collect more added and deleted labels
switch event.Typ {
case kvstore.EventTypeCreate, kvstore.EventTypeDelete:
collectEvent(event, added, deleted)
default:
// Ignore modify events
}
default:
// No more events available without blocking
break More
}
}... | |
c163564 | {
return identity
}
if IdentityAllocator == nil {
return nil
}
lblArray := lbls.LabelArray()
id, err := IdentityAllocator.Get(context.TODO(), globalIdentity{lblArray})
if err != nil {
return nil
}
if id == idpool.NoID {
return nil
}
return identity.NewIdentityFromLabelArray(identity.NumericIdenti... | |
c163565 |
// type. This is to prevent users from adding cilium-reserved labels
// into the workloads.
case lbl.Source == labels.LabelSourceReserved:
if len(lbls) != 1 {
return nil
}
id := identity.GetReservedID(lbl.Key)
if id != identity.IdentityUnknown && !identity.IsUserReservedIdentity(id) {
return ... | |
c163566 | {
return identity
}
allocatorKey, err := IdentityAllocator.GetByID(idpool.ID(id))
if err != nil {
return nil
}
if gi, ok := allocatorKey.(globalIdentity); ok {
return identity.NewIdentityFromLabelArray(id, gi.LabelArray)
}
return nil
} | |
c163567 | }
if !identity.IsUserReservedIdentity(ni) {
return identity.ErrNotUserIdentity
}
}
for k, lbl := range m {
ni, _ := identity.ParseNumericIdentity(k)
identity.AddUserDefinedNumericIdentity(ni, lbl)
identity.AddReservedIdentity(ni, lbl)
}
return nil
} | |
c163568 | {
return &fakeciliumv2.FakeCiliumV2{Fake: &c.Fake}
} | |
c163569 | IP: ip,
Mask: defaults.ContainerIPv6Mask,
},
},
{
Prefix: defaults.IPv6DefaultRoute,
Nexthop: &ip,
MTU: linkMTU,
},
}, nil
} | |
c163570 | IP: ip,
Mask: defaults.ContainerIPv4Mask,
},
},
{
Prefix: defaults.IPv4DefaultRoute,
Nexthop: &ip,
MTU: linkMTU,
},
}, nil
} | |
c163571 |
}
if addr.IPV4 != nil && addr.IPV4.IP != "" {
return nil
}
return fmt.Errorf("Either IPv4 or IPv6 addressing must be provided")
} | |
c163572 | "bpfCompilation": &s.bpfCompilation,
"bpfWaitForELF": &s.bpfWaitForELF,
"bpfWriteELF": &s.bpfWriteELF,
"bpfLoadProg": &s.bpfLoadProg,
}
} | |
c163573 | error {
return kvstore.Delete(key)
} | |
c163574 |
return nil
}
refcnt--
if refcnt == 0 {
delete(r.keys, key)
delete(r.marshaledIPIDPairs, key)
err = r.store.release(ctx, key)
} else {
r.keys[key] = refcnt
}
return err
} | |
c163575 | make(chan struct{}),
synced: make(chan struct{}),
}
return watcher
} | |
c163576 | go func() {
log.Info("Starting IP identity watcher")
watcher = NewIPIdentityWatcher(kvstore.Client())
close(initialized)
watcher.Watch()
}()
})
} | |
c163577 | ipc.listeners = listeners
ipc.mutex.Unlock()
} | |
c163578 |
return
}
return checkPrefixLengthsAgainstMap(impl, prefixes, IPIdentityCache.v6PrefixLengths, true)
} | |
c163579 | ok := prefixLengths[length]; ok {
prefixLengths[length]++
} else {
prefixLengths[length] = 1
}
} | |
c163580 | delete(prefixLengths, length)
} else {
prefixLengths[length]--
}
} | |
c163581 | 8
}
return &net.IPNet{
IP: ip,
Mask: net.CIDRMask(bits, bits),
}
} | |
c163582 | := net.ParseIP(ip)
cidr = endpointIPToCIDR(endpointIP)
}
listener.OnIPIdentityCacheChange(Upsert, *cidr, nil, hostIP, nil, identity.ID, encryptKey)
}
} | |
c163583 | if cidrIdentity.ID != cachedIdentity.ID || bytes.Compare(oldHostIP, newHostIP) != 0 {
scopedLog.Debug("Removal of endpoint IP revives shadowed CIDR to identity mapping")
cacheModification = Upsert
oldIdentity = &cachedIdentity.ID
newIdentity = cidrIdentity
} else {
// The endpoint IP and the CI... | |
c163584 | defer ipc.mutex.Unlock()
ipc.deleteLocked(IP, source)
} | |
c163585 | defer ipc.mutex.RUnlock()
return ipc.LookupByIPRLocked(IP)
} | |
c163586 | bool) {
identity, exists := ipc.ipToIdentityCache[IP]
return identity, exists
} | |
c163587 | defer ipc.mutex.RUnlock()
return ipc.LookupByPrefixRLocked(IP)
} | |
c163588 | return firstGlobalAddr(intf, preferredIP, netlink.FAMILY_V6)
} | |
c163589 |
for _, ip := range v4Addrs {
if netlink.Scope(ip.Scope) == netlink.SCOPE_UNIVERSE {
SetInternalIPv4(ip.IP)
return nil
}
}
return errors.New("unable to find IP addresses with scope global")
} | |
c163590 | m.validateEndpointPolicyEnabledEnum("", "body", m); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | |
c163591 | nextID,
maxID: maxID,
initNextID: nextID,
initMaxID: maxID,
}
} | |
c163592 | out := new(AWSGroup)
in.DeepCopyInto(out)
return out
} | |
c163593 | out := new(CIDRRule)
in.DeepCopyInto(out)
return out
} | |
c163594 | out := new(CIDRRuleSlice)
in.DeepCopyInto(out)
return *out
} | |
c163595 | := new(CIDRSlice)
in.DeepCopyInto(out)
return *out
} | |
c163596 | out := new(EgressRule)
in.DeepCopyInto(out)
return out
} | |
c163597 | }
out := new(EndpointSelector)
in.DeepCopyInto(out)
return out
} | |
c163598 | }
out := new(EndpointSelectorSlice)
in.DeepCopyInto(out)
return *out
} | |
c163599 | out := new(EntitySlice)
in.DeepCopyInto(out)
return *out
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.