id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c162400
globalSweeper.walk); err != nil { log.WithError(err).Warn("Error while scanning for stale maps") } }
c162401
"cilium_snat_v4_external", "cilium_proxy4"}...) } for _, m := range maps { p := path.Join(bpf.MapPrefixPath(), m) if _, err := os.Stat(p); !os.IsNotExist(err) { globalSweeper.removeMapPath(p) } } }
c162402
*GetIdentityEndpointsOK { o.Payload = payload return o }
c162403
mark |= (identity >> 16) & 0xFF mark |= (identity & 0xFFFF) << 16 } return mark }
c162404
} if err := m.validateUUID(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162405
r.Nexthop, "local": r.Local, logfields.Interface: r.Device, } }
c162406
prog.OutputType), "-o", path.Join(dir.Output, prog.Output), } }
c162407
nil { stdout.Close() return nil, nil, fmt.Errorf("Failed to get stderr pipe: %s", err) } return stdout, stderr, nil }
c162408
if err != nil { err = fmt.Errorf("Failed to compile %s: %s", prog.Output, err) log.WithFields(logrus.Fields{ "compiler-pid": pidFromProcess(compileCmd.Process), "linker-pid": pidFromProcess(linkCmd.Process), }).Error(err) if compileOut != nil { scopedLog := log.Warn if debug { scopedLog = lo...
c162409
fmt.Sprintf("-I%s", dir.Library), fmt.Sprintf("-I%s", path.Join(dir.Library, "include")), "-c", path.Join(dir.Library, prog.Source), "-o", output, ) }
c162410
outputSource { compileCmd := exec.CommandContext(ctx, compiler, args...) _, err = compileCmd.CombinedOutput(log, debug) } else { switch prog.OutputType { case outputObject: err = compileAndLink(ctx, prog, dir, debug, args...) case outputAssembly: err = compileAndLink(ctx, prog, dir, false, args...) ...
c162411
OutputType: outputObject, } dirs := directoryInfo{ Library: option.Config.BpfDir, Runtime: option.Config.StateDir, Output: option.Config.StateDir, State: option.Config.StateDir, } return compile(ctx, &prog, &dirs, debug) }
c162412
Runtime: option.Config.StateDir, Output: out, State: out, } return compileDatapath(ctx, &dirs, option.Config.BPFCompilationDebug, log) }
c162413
defer s.locker.Unlock() s.observers[observer] = struct{}{} }
c162414
defer s.locker.Unlock() delete(s.observers, observer) }
c162415
s.observers { o.HandleNewResourceVersion(typeURL, version) } }
c162416
res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162417
time.Duration) *DeleteServiceIDParams { o.SetTimeout(timeout) return o }
c162418
*DeleteServiceIDParams { o.SetContext(ctx) return o }
c162419
{ o.SetHTTPClient(client) return o }
c162420
int64) *DeleteServiceIDParams { o.SetID(id) return o }
c162421
stop: make(chan struct{}, 0), update: make(chan struct{}, 1), terminated: make(chan struct{}, 0), } ctrl.updateParamsLocked(params) ctrl.getLogger().Debug("Starting new controller") ctrl.ctxDoFunc, ctrl.cancelDoFunc = context.WithCancel(context.Background()) m.controllers[ctrl.name] = ctrl...
c162422
err := m.removeAndReturnController(name) return err }
c162423
c.terminated } c := make(chan struct{}, 0) close(c) return c }
c162424
ctrl := range ctrls { <-ctrl.terminated } }
c162425
} m.mutex.RUnlock() statuses := models.ControllerStatuses{} for _, c := range controllers { statuses = append(statuses, c.GetStatusModel()) } return statuses }
c162426
stop: make(chan struct{}, 0), update: make(chan struct{}, 1), terminated: make(chan struct{}, 0), lastError: fmt.Errorf("controller failed"), failureCount: 1, consecutiveErrors: 1, } ctrl.ctxDoFunc, ctrl.cancelDoFunc = context.WithCancel(context.Backgroun...
c162427
cli.Connectivity = connectivity.New(transport, formats) cli.Restapi = restapi.New(transport, formats) return cli }
c162428
{ log.WithError(err).Error("apiserver shutdown") } }() if err := srv.ListenAndServe(); err != nil { log.WithError(err).Error("apiserver listen") } }
c162429
else if _, err := k8s.Client().Discovery().ServerVersion(); err != nil { return err } return nil }
c162430
{ params.SetOwner(&owner) } resp, err := c.IPAM.PostIPAM(params) if err != nil { return nil, Hint(err) } return resp.Payload, nil }
c162431
arams().WithIP(ip).WithOwner(&owner).WithTimeout(api.ClientTimeout) _, err := c.IPAM.PostIPAMIP(params) return Hint(err) }
c162432
_, err := c.IPAM.DeleteIPAMIP(params) return Hint(err) }
c162433
c.mutex.RUnlock() return c.successCount }
c162434
c.mutex.RUnlock() return c.failureCount }
c162435
c.mutex.RUnlock() return c.lastError }
c162436
defer c.mutex.RUnlock() return c.lastErrorStamp }
c162437
> maxInterval { c.getLogger().Infof("Limiting interval to %s", maxInterval) c.params.RunInterval = maxInterval } }
c162438
fieldControllerName: c.name, fieldUUID: c.uuid, }) }
c162439
LastSuccessTimestamp: strfmt.DateTime(c.lastSuccessStamp), FailureCount: int64(c.failureCount), LastFailureTimestamp: strfmt.DateTime(c.lastErrorStamp), ConsecutiveFailureCount: int64(c.consecutiveErrors), }, } if c.lastError != nil { status.Status.LastFailureMsg = c.lastError.Error()...
c162440
metrics.ControllerRunsDuration.WithLabelValues(failure).Observe(c.lastDuration.Seconds()) }
c162441
metrics.ControllerRuns.WithLabelValues(success).Inc() metrics.ControllerRunsDuration.WithLabelValues(success).Observe(c.lastDuration.Seconds()) }
c162442
range CIDRMatchAll { if *c == wildcard { return true } } return false }
c162443
:= EndpointSelectorSlice{} for _, cidr := range s { if cidr.MatchesAll() && !hasWorldBeenAdded { hasWorldBeenAdded = true slice = append(slice, ReservedEndpointSelectors[labels.IDNameWorld]) } lbl, err := cidrpkg.IPStringToLabel(string(cidr)) if err == nil { slice = append(slice, NewESFromLabels(lbl)...
c162444
{ result = append(result, string(c)) } return result }
c162445
} resultantAllowedCIDRs, _ := ip.RemoveCIDRs([]*net.IPNet{allowNet}, removeSubnets) for _, u := range resultantAllowedCIDRs { allResultantAllowedCIDRs = append(allResultantAllowedCIDRs, CIDR(u.String())) } } return allResultantAllowedCIDRs }
c162446
&GetHealthz{Context: ctx, Handler: handler} }
c162447
mutex.RUnlock() return chainingPlugins[name] }
c162448
{ result.Family = EndpointKeyIPv6 copy(result.IP[:], ip) } result.Key = 0 return result }
c162449
EndpointKeyIPv4: return k.IP[:4] case EndpointKeyIPv6: return k.IP[:] } return nil }
c162450
ip != nil { return fmt.Sprintf("%s:%d", ip.String(), k.Key) } return "nil" }
c162451
&PatchEndpointID{Context: ctx, Handler: handler} }
c162452
local %s instance", targetName) time.Sleep(connectRetryInterval) continue } for { status := &models.Status{ State: models.StatusStateOk, } if _, err := ch.client.Restapi.GetHello(nil); err != nil { status.Msg = ciliumPkg.Hint(err).Error() status.State = models.StatusStateWarning } ...
c162453
:= ch.status ch.Mutex.RUnlock() return status }
c162454
ch.status = status ch.Mutex.Unlock() }
c162455
// Parameter is provided by construction from the route o.IP = raw return nil }
c162456
models.Error) *DeleteFqdnCacheBadRequest { o.Payload = payload return o }
c162457
{ return filepath.Join(".", fmt.Sprintf("%d", e.ID)) }
c162458
{ return filepath.Join(option.Config.StateDir, e.StringID()) }
c162459
bpf objects into the new directory if !compilationExecuted { scopedLog.Debug("compilation was skipped; moving old BPF objects into new directory") err := common.MoveNewFilesTo(backupDir, origDir) if err != nil { log.WithError(err).Debugf("unable to copy old bpf object "+ "files from %s into the new...
c162460
{ return path.Join(nn.Cluster, nn.Name) }
c162461
path.Join(n.Cluster, n.Name) } return n.Name }
c162462
PrimaryAddress: n.getPrimaryAddress(), SecondaryAddresses: n.getSecondaryAddresses(), HealthEndpointAddress: n.getHealthAddresses(), } }
c162463
Identity{ Name: n.Name, Cluster: n.Cluster, } }
c162464
} if (n.IPv4AllocCIDR == nil) != (o.IPv4AllocCIDR == nil) { return false } if n.IPv4AllocCIDR.String() != o.IPv4AllocCIDR.String() { return false } if (n.IPv6AllocCIDR == nil) != (o.IPv6AllocCIDR == nil) { return false } if n.IPv6AllocCIDR.String() != o.IPv6AllocCIDR.String() { return fal...
c162465
err != nil { return err } *n = newNode return nil }
c162466
lookup %q: %v", ifName, err) } if err = netlink.LinkDel(iface); err != nil { return fmt.Errorf("failed to delete %q: %v", ifName, err) } return nil }
c162467
err } return netlink.LinkSetName(link, newName) }
c162468
i >= 0; i, j = i-1, j+1 { c[j] = b[i] } return c }
c162469
return swap32(b.(uint32)) default: panic(unsupported(b)) } }
c162470
return swap32(n.(uint32)) default: panic(unsupported(n)) } }
c162471
return binary.BigEndian.Uint16(b) default: panic(unsupported(b)) } }
c162472
binary.BigEndian.PutUint16(b, v.(uint16)) default: panic(unsupported(v)) } }
c162473
Native.PutUint16(b, v.(uint16)) default: panic(unsupported(v)) } }
c162474
return binary.BigEndian.Uint16(reverse(b)) } return binary.BigEndian.Uint16(b) default: panic(unsupported(t)) } }
c162475
%v", reflect.TypeOf(field).Kind(), field) }
c162476
nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162477
*GetPolicyOK { o.Payload = payload return o }
c162478
map[ServiceID]*Endpoints{}, ingresses: map[ServiceID]*Service{}, externalEndpoints: map[ServiceID]externalEndpoints{}, Events: make(chan ServiceEvent, 128), } }
c162479
_, port := range svc.Ports { return loadbalancer.NewL3n4Addr(port.Protocol, svc.FrontendIP, port.Port) } return nil }
c162480
return svcID } } s.services[svcID] = newService // Check if the corresponding Endpoints resource is already available endpoints, serviceReady := s.correlateEndpoints(svcID) if serviceReady { s.Events <- ServiceEvent{ Action: UpdateService, ID: svcID, Service: newService, Endpoints:...
c162481
:= s.correlateEndpoints(svcID) delete(s.services, svcID) s.mutex.Unlock() if serviceOK { s.Events <- ServiceEvent{ Action: DeleteService, ID: svcID, Service: oldService, Endpoints: endpoints, } } }
c162482
:= s.correlateEndpoints(svcID) if ok && serviceReady { s.Events <- ServiceEvent{ Action: UpdateService, ID: svcID, Service: service, Endpoints: endpoints, } } return svcID, newEndpoints }
c162483
:= s.correlateEndpoints(svcID) s.mutex.Unlock() if serviceOK { event := ServiceEvent{ Action: DeleteService, ID: svcID, Service: service, Endpoints: endpoints, } if serviceReady { event.Action = UpdateService } s.Events <- event } return svcID }
c162484
return svcID, nil } } s.ingresses[svcID] = newService s.Events <- ServiceEvent{ Action: UpdateIngress, ID: svcID, Service: newService, } return svcID, nil }
c162485
ServiceEvent{ Action: DeleteIngress, ID: svcID, Service: oldService, Endpoints: endpoints, } } }
c162486
exists { return } } // If the protocol is set, perform an exact match default: _, exists = l[frontend.StringWithProtocol()] } return }
c162487
for _, p := range svc.Ports { address := loadbalancer.L3n4Addr{ IP: svc.FrontendIP, L4Addr: *p.L4Addr, } uniqueFrontends[address.StringWithProtocol()] = struct{}{} } } return uniqueFrontends }
c162488
spew.Sdump(s) s.mutex.RUnlock() return str }
c162489
&GetEndpointIDHealthz{Context: ctx, Handler: handler} }
c162490
*GetStatusOK { o.Payload = payload return o }
c162491
unsafe.Sizeof(attr)) metricSyscallDuration.WithLabelValues(metricOpProgGetNextID, metrics.Errno2Outcome(err)).Observe(duration.End(err == 0).Total().Seconds()) if ret != 0 || err != 0 { return 0, fmt.Errorf("Unable to get next id: %v", err) } return attr.nextID, nil }
c162492
uintptr(unsafe.Pointer(&attr)), unsafe.Sizeof(attr)) if fd < 0 || err != 0 { return int(fd), fmt.Errorf("Unable to get fd for program id %d: %v", id, err) } return int(fd), nil }
c162493
err := unix.Syscall(unix.SYS_BPF, BPF_OBJ_GET_INFO_BY_FD, uintptr(unsafe.Pointer(&attr)), unsafe.Sizeof(attr)) metricSyscallDuration.WithLabelValues(metricOpObjGetInfoByFD, metrics.Errno2Outcome(err)).Observe(duration.End(err == 0).Total().Seconds()) if ret != 0 || err != 0 { return ProgInfo{}, fmt.Errorf("Unable ...
c162494
&GetEndpoint{Context: ctx, Handler: handler} }
c162495
listMissingIPNets(createIPNetMap(new), old) return }
c162496
nodeToID: nodeToID, pendingCompletions: make(map[*completion.Completion]*pendingCompletion), } }
c162497
// Completion was canceled or timed out. // Remove from pending list. ackLog.Debugf("completion context was canceled: %v", pending) continue } if pending.typeURL == typeURL { if pending.version <= nackVersion { // Get the set of resource names we are still waiting for the node // to ACK. ...
c162498
{ return c[i].offset < c[j].offset }) return c }
c162499
os.Stdout.Write(debug.Stack()) } wr.WriteHeader(http.StatusInternalServerError) if _, err := wr.Write([]byte("Internal error occurred, check Cilium logs for details.")); err != nil { log.WithError(err).Debug("Failed to write API response") } } }() h.Next.ServeHTTP(wr, req) }