id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c162300
nil); err != nil { log.WithError(err).Warn("Unable to serve pprof API") } }() }
c162301
return &Parser{connection: connection, injectQueue: make([]queuedInject, 0)} }
c162302
{ res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162303
}, "603e047d2268a57f5a5f93f7f9e1263e9207e348a06654bf64948def00100257": { EndpointID: "93529fda8c401a071d21d6bd46fdf5499b9014dcb5a35f2e3efaa8d800200257", }, "603e047d2268a57f5a5f93f7f9e1263e9207e348a06654bf64948def00100258": { EndpointID: "93529fda8c401a071d21d6bd46fdf5499b9014dcb5a35f2e3efaa8d800...
c162304
continue } if cJSON.Config == nil || !utils.IsInfraContainer(cJSON.Config.Labels) { continue } if cJSON.State == nil || !cJSON.State.Running { continue } pids[cJSON.ID] = cJSON.State.Pid } return pids, nil }
c162305
= fmt.Sprintf("#define HAVE_LPM_MAP_TYPE") case MapTypeLRUHash: featureString = fmt.Sprintf("#define HAVE_LRU_MAP_TYPE") default: break } return featureString }
c162306
time.Duration(try) * time.Second }
c162307
} } if injected > 0 { p.replyQueue = p.replyQueue[injected:] } return injected * len(DeniedMsg) }
c162308
net.ParseIP("1.1.1.2"), primaryExternal: net.ParseIP("1.1.1.1"), allocCIDR: cidr.MustParseCIDR("1.1.1.0/24"), }, ipv6: addressFamily{}, } }
c162309
allocCIDR: cidr.MustParseCIDR("1.1.1.0/24"), }, ipv6: addressFamily{ router: net.ParseIP("cafe::2"), primaryExternal: net.ParseIP("cafe::1"), allocCIDR: cidr.MustParseCIDR("cafe::/96"), }, } }
c162310
time.Duration) *GetEndpointIDLabelsParams { o.SetTimeout(timeout) return o }
c162311
context.Context) *GetEndpointIDLabelsParams { o.SetContext(ctx) return o }
c162312
*http.Client) *GetEndpointIDLabelsParams { o.SetHTTPClient(client) return o }
c162313
string) *GetEndpointIDLabelsParams { o.SetID(id) return o }
c162314
o.Payload = payload return o }
c162315
enough to actively // wait for a new value. for uuid.Equal(lastUUID, result) == true { result = uuid.NewUUID() } lastUUID = result return result }
c162316
time.Duration) *PatchEndpointIDConfigParams { o.SetTimeout(timeout) return o }
c162317
context.Context) *PatchEndpointIDConfigParams { o.SetContext(ctx) return o }
c162318
*http.Client) *PatchEndpointIDConfigParams { o.SetHTTPClient(client) return o }
c162319
{ o.SetEndpointConfiguration(endpointConfiguration) return o }
c162320
string) *PatchEndpointIDConfigParams { o.SetID(id) return o }
c162321
"" { config, err := clientcmd.BuildConfigFromFlags("", kubeCfgPath) if err != nil { return nil, err } config.UserAgent = userAgent return config, nil } config := &rest.Config{Host: endpoint, UserAgent: userAgent} err := rest.SetKubernetesDefaults(config) return config, err }
c162322
return createConfig(resp.Status.K8sEndpoint, resp.Status.K8sConfiguration) }
c162323
select { case <-timeout.C: log.WithError(err).WithField(logfields.IPAddr, config.Host).Error("Unable to contact k8s api-server") close(stop) default: } }, 5*time.Second, stop) if err == nil { log.Info("Connected to apiserver") } return cs, err }
c162324
c.CoreV1().ComponentStatuses().Get("controller-manager", metav1.GetOptions{}) return err }
c162325
backend := range b.backendsV2 { backends[addrID] = backend } return backends }
c162326
b := &bpfBackend{ id: backend.BackendAddrID(), bpfValue: backend, } if _, ok := bpfSvc.uniqueBackends[backend.BackendAddrID()]; ok { b.isHole = true } else { bpfSvc.uniqueBackends[backend.BackendAddrID()] = backend bpfSvc.slaveSlotByBackendAddrID[backend.BackendAddrID()] = index + 1 ...
c162327
delete(bpfSvc.slaveSlotByBackendAddrID, addrID) } } } // Step 2: Delete all backends that no longer exist in the service v2. for addrID := range bpfSvc.backendsV2 { if _, ok := newBackendsMap[addrID]; !ok { isLastInstanceRemoved, err := l.delBackendV2Locked(addrID) if err != nil { return nil, nil...
c162328
bool { l.backendRefCount[addrID]++ return l.backendRefCount[addrID] == 1 }
c162329
{ delete(l.backendRefCount, addrID) return true, nil } l.backendRefCount[addrID]-- return false, nil }
c162330
if isLastInstance { backendsToRemove = append(backendsToRemove, l.backendIDByAddrID[addrID]) delete(l.backendIDByAddrID, addrID) } } // FIXME(brb) uncomment the following line after we have removed the support for // legacy svc. //delete(l.entries, frontendID) return backendsToRemove, count, nil }
c162331
{ if l.backendRefCount[addrID] == 0 { delete(l.backendIDByAddrID, addrID) removed[addrID] = id } } return removed }
c162332
false if raw == "" { // empty values pass all other validations return nil } o.Cidr = &raw return nil }
c162333
// Multiple worker threads serving the listener share that same connection uc, err := accessLogListener.AcceptUnix() if err != nil { // These errors are expected when we are closing down if strings.Contains(err.Error(), "closed network connection") || strings.Contains(err.Error(), "invalid argume...
c162334
{ return d.Finished.Sub(d.Started) }
c162335
} return metav1.FormatLabelSelector(n.LabelSelector) }
c162336
:= n.MarshalJSON() return string(j) }
c162337
v } n.MatchLabels = ml } if n.MatchExpressions != nil { newMatchExpr := make([]metav1.LabelSelectorRequirement, len(n.MatchExpressions)) for i, v := range n.MatchExpressions { v.Key = labels.GetExtendedKeyFrom(v.Key) newMatchExpr[i] = v } n.MatchExpressions = newMatchExpr } n.requirements = label...
c162338
nil { newMatchExpr := make([]metav1.LabelSelectorRequirement, len(n.MatchExpressions)) for i, v := range n.MatchExpressions { v.Key = labels.GetCiliumKeyFrom(v.Key) newMatchExpr[i] = v } ls.MatchExpressions = newMatchExpr } return json.Marshal(ls) }
c162339
n.MatchExpressions { if strings.HasPrefix(v.Key, prefix) { return true } } return false }
c162340
for _, v := range n.MatchExpressions { if v.Key == key { return true } } return false }
c162341
v.Operator == metav1.LabelSelectorOpIn { return v.Values, true } } return nil, false }
c162342
ml[lbl.GetExtendedKey()] = lbl.Value } return NewESFromMatchRequirements(ml, nil) }
c162343
:= labels.NewLabel(ID, "", labels.LabelSourceReserved) return NewESFromLabels(reservedLabels) }
c162344
{ if matchExpressions == nil { matchExpressions = make([]metav1.LabelSelectorRequirement, 0, len(ls.MatchExpressions)) } for _, v := range ls.MatchExpressions { v.Key = srcPrefix + v.Key matchExpressions = append(matchExpressions, v) } } } return NewESFromMatchRequirements(matchLabels, matc...
c162345
= map[string]string{} } n.MatchLabels[key] = value n.requirements = labelSelectorToRequirements(n.LabelSelector) }
c162346
{ return false } } for k := range n.MatchLabels { if k == labels.LabelSourceReservedKeyPrefix+labels.IDNameAll { return true } } for _, req := range *n.requirements { if !req.Matches(lblsToMatch) { return false } } return true }
c162347
len(n.LabelSelector.MatchLabels)+len(n.LabelSelector.MatchExpressions) == 0 }
c162348
requirementFromMatchLabels := metav1.LabelSelectorRequirement{ Key: key, Operator: metav1.LabelSelectorOpIn, Values: []string{value}, } requirements = append(requirements, requirementFromMatchLabels) } return requirements }
c162349
return fmt.Errorf("invalid label selector: %s", errList.ToAggregate().Error()) } return nil }
c162350
if selector.Matches(ctx) { return true } } return false }
c162351
selector.IsWildcard() { return true } } return false }
c162352
&GetMapName{Context: ctx, Handler: handler} }
c162353
return &WaitGroup{ctx: ctx2, cancel: cancel} }
c162354
{ // 'comp' may have already completed on a different error compErr := comp.Complete(wg.ctx.Err()) err = updateError(err, compErr) // Keep the most severe error value we encounter } break Loop } } wg.pendingCompletions = nil return err }
c162355
c.lock.Lock() defer c.lock.Unlock() return c.err }
c162356
// We must call the callbacks synchronously to guarantee // that they are actually called before Wait() returns. c.callback(err) } // Cancel the WaitGroup on failure if err != nil && c.cancel != nil { c.cancel() } close(c.completed) } c.lock.Unlock() return err }
c162357
*GetIdentityOK { o.Payload = payload return o }
c162358
models.Error) *GetIdentityUnreachable { o.Payload = payload return o }
c162359
models.Error) *GetIdentityInvalidStorageFormat { o.Payload = payload return o }
c162360
{ res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162361
"" || rr.cmdExact == "READ" || rr.cmdExact == "WRITE") { proxylib.ParseError(fmt.Sprintf("Unable to parse L7 r2d2 rule, cmd '%s' is not compatible with 'file'", rr.cmdExact), rule) } regexStr := "" if rr.fileRegexCompiled != nil { regexStr = rr.fileRegexCompiled.String() } log.Infof("Parsed rule '%s' '...
c162362
:= c.Policy.GetIdentityID(params) if err != nil { return nil, Hint(err) } return resp.Payload, nil }
c162363
fetch_u32(%s)\n", name, value, value, name, name) }
c162364
} nboAddr := byteorder.HostSliceToNetwork(addr, reflect.Uint32).(uint32) return defineUint32(name, nboAddr) }
c162365
} return fmt.Sprintf("DEFINE_IPV6(%s, %s);\n", name, goArray2C(addr)) }
c162366
} return fmt.Sprintf("DEFINE_MAC(%s, %s);\n#define %s fetch_mac(%s)\n", name, goArray2C(addr), name, name) }
c162367
err = ev.ep.regenerate(ev.owner, ev.regenContext) doneFunc() e.notifyEndpointRegeneration(owner, err) } else { // If another build has been queued for the endpoint, that means that // that build will be able to take care of all of the work needed to // regenerate the endpoint at this current point in tim...
c162368
regeneration failed, so there is no way that we can // realize the policy revision yet. Should this be signaled // to the routine waiting for the result of this event? ev.ep.SetPolicyRevision(ev.Rev) res <- struct{}{} }
c162369
revision event results - it is best effort. _ = e.EventQueue.Enqueue(epBumpEvent) }
c162370
if revertFunc != nil { s.revertFuncs = append(s.revertFuncs, revertFunc) } }
c162371
to execute revert function; skipping %d revert functions: %s", i, err) } } return nil }
c162372
res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162373
*GetMapOK { o.Payload = payload return o }
c162374
{ o.Payload = payload return o }
c162375
c.Policy.PutPolicy(params) if err != nil { return nil, Hint(err) } return resp.Payload, nil }
c162376
c.Policy.GetPolicy(params) if err != nil { return nil, Hint(err) } return resp.Payload, nil }
c162377
c.Policy.DeletePolicy(params) if err != nil { return nil, Hint(err) } return resp.Payload, Hint(err) }
c162378
c.Policy.GetPolicyResolve(params) if err != nil { return nil, Hint(err) } return resp.Payload, nil }
c162379
interface{}) { ret = append(ret, m.(*v2.CiliumNetworkPolicy)) }) return ret, err }
c162380
{ return ciliumNetworkPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} }
c162381
{ err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { ret = append(ret, m.(*v2.CiliumNetworkPolicy)) }) return ret, err }
c162382
// Find the JSON within the quoted string. nestedStart := 0 nestedEnd := 0 if locs := reJSON.FindAllStringIndex(unquoted, -1); locs != nil { // The last match is the longest one. last := len(locs) - 1 nestedStart = locs[last][0] nestedEnd = locs[last][1] } else if reJSON.Match(quotedBytes) { // ...
c162383
return trafficdirection.Egress, nil default: return trafficdirection.Invalid, fmt.Errorf("invalid direction %q provided", td) } }
c162384
var proxyPort uint16 if err := policyMap.Allow(pa.label, pa.port, u8p, pa.trafficDirection, proxyPort); err != nil { Fatalf("Cannot add policy key '%s': %s\n", entry, err) } } else { if err := policyMap.Delete(pa.label, pa.port, u8p, pa.trafficDirection); err != nil { Fatalf("Cannot delete policy k...
c162385
if enabled, err := option.NormalizeBool(value); err != nil { // If it cannot be parsed as a bool, just format the value. fmt.Printf("%-24s %s\n", k, color.Green(value)) } else if enabled == option.OptionDisabled { fmt.Printf("%-24s %s\n", k, color.Red("Disabled")) } else { fmt.Printf("%-24s %s\n", k, c...
c162386
non-existent listener: %s", name) } s.mutex.Unlock() return func(completion *completion.Completion) { s.mutex.Lock() if listenerRevertFunc != nil { listenerRevertFunc(completion) } listener.count++ s.listeners[name] = listener s.mutex.Unlock() } }
c162387
convert the policies for ingress and egress. if policy != nil { p.IngressPerPortPolicies = getDirectionNetworkPolicy(policy.Ingress, ingressPolicyEnforced, labelsMap, deniedIngressIdentities) p.EgressPerPortPolicies = getDirectionNetworkPolicy(policy.Egress, egressPolicyEnforced, labelsMap, deniedEgressIdentities...
c162388
false) delete(s.networkPolicyEndpoints, name) } if ep.GetIPv4Address() != "" { name := ep.GetIPv4Address() s.networkPolicyCache.Delete(NetworkPolicyTypeURL, name, false) delete(s.networkPolicyEndpoints, name) } }
c162389
len(resources.Resources)) for _, res := range resources.Resources { networkPolicy := res.(*cilium.NetworkPolicy) networkPolicies[networkPolicy.Name] = networkPolicy } return networkPolicies, nil }
c162390
defer s.mutex.RUnlock() return s.networkPolicyEndpoints[networkPolicyName] }
c162391
value := range h.Headers { if o.Headers[i] != value { return false } } return true }
c162392
:= range rules.DNS { if d.Equal(existingRule) { return true } } return false }
c162393
:= range rules.L7 { if h.Equal(existingRule) { return true } } return false }
c162394
} for k, v := range *h { if v2, ok := o[k]; !ok || v2 != v { return false } } return true }
c162395
ProtoUDP: default: return fmt.Errorf("invalid protocol %q, must be { tcp | udp | any }", l4) } return nil }
c162396
p := L4Proto(strings.ToUpper(proto)) return p, p.Validate() }
c162397
return policymap.RemoveGlobalMapping(uint32(endpointID)) }
c162398
map file") } else { log.WithField(logfields.Path, path).Info("Removed stale bpf map") } }
c162399
endpointID) if filename != bpf.LocalMapName(prefix, epID) { ms.removeMapPath(path) } } else { err2 := ms.removeDatapathMapping(epID) if err2 != nil { log.WithError(err2).Debugf("Failed to remove ID %d from global policy map", tmp) } ms.removeMapPath(path) } } }