id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c163300
{ o.SetTimeout(timeout) return o }
c163301
*GetServiceIDParams { o.SetContext(ctx) return o }
c163302
*http.Client) *GetServiceIDParams { o.SetHTTPClient(client) return o }
c163303
int64) *GetServiceIDParams { o.SetID(id) return o }
c163304
labels.NewLabel(k8sConst.PolicyLabelNamespace, ns, labels.LabelSourceK8s), labels.NewLabel(k8sConst.PolicyLabelUID, string(uid), labels.LabelSourceK8s), } }
c163305
case. // Those pods don't have any labels, so they don't have a namespace label either. // Don't add a namespace label to those endpoint selectors, or we wouldn't be // able to match on those pods. if !matchesInit && !es.HasKey(podPrefixLbl) && !es.HasKey(podAnyPrefixLbl) { es.AddMatch(podPrefixLbl, namespace) ...
c163306
(len(userNamespaces) == 1 && userNamespaces[0] == namespace) }
c163307
+ ".illegal": userNamespace, }).Warn("CiliumNetworkPolicy contains illegal namespace match in EndpointSelector." + " EndpointSelector always applies in namespace of the policy resource, removing illegal namespace match'.") } retRule.EndpointSelector.AddMatch(podPrefixLbl, namespace) } } parseToCili...
c163308
{ policyLbls := GetPolicyLabels(namespace, name, uid, ResourceTypeCiliumNetworkPolicy) return append(policyLbls, ruleLbs...).Sort() }
c163309
err != nil { if option.Config.EnableIPv6 { log.WithError(err).Fatal( "IPv6 is enabled and ip6tables modules could not be initialized") } log.WithError(err).Debug( "ip6tables kernel modules could not be loaded, so IPv6 cannot be used") ip6tables = false } m.ip6tables = ip6tables }
c163310
version if m.ip6tables { tables6 := []string{"mangle", "raw"} for _, t := range tables6 { removeCiliumRules(t, "ip6tables") } } for _, c := range ciliumChains { c.remove() } }
c163311
} else { if err := iptEgressProxyRule(cmd, "tcp", proxyPort, name); err != nil { return err } if err := iptEgressProxyRule(cmd, "udp", proxyPort, name); err != nil { return err } } return nil }
c163312
err := m.validatePolicy(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163313
!= nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163314
&GetMetrics{Context: ctx, Handler: handler} }
c163315
o.SetTimeout(timeout) return o }
c163316
*PostIPAMParams { o.SetContext(ctx) return o }
c163317
o.SetHTTPClient(client) return o }
c163318
o.SetFamily(family) return o }
c163319
o.SetOwner(owner) return o }
c163320
*Rule { r.EndpointSelector = es return r }
c163321
r.Ingress = rules return r }
c163322
r.Egress = rules return r }
c163323
*Rule { r.Labels = labels return r }
c163324
r.Description = desc return r }
c163325
if rule.RequiresDerivative() { return true } } return false }
c163326
newRule, err } newRule.Egress = append(newRule.Egress, *derivativeEgressRule) } return newRule, nil }
c163327
bpf.LocalMapPath(policymap.MapName, e.ID) }
c163328
{ return bpf.LocalMapPath(loader.CallsMapName, e.ID) }
c163329
{ return bpf.LocalMapPath(bpfconfig.MapNamePrefix, e.ID) }
c163330
{ revertStack.Revert() // Ignore errors while reverting. This is best-effort. return desiredRedirects, fmt.Errorf("unable to allocate egress redirects: %s", err), nil, nil } finalizeList.Append(ff) revertStack.Push(rf) return desiredRedirects, nil, finalizeList.Finalize, func() error { e.getLogger().Debug("...
c163331
// Update the endpoint API model to report that no redirect is // active or known for that port anymore. We never delete stats // until an endpoint is deleted, so we only set the redirect port // to 0. // // We don't know the L7 protocol of the redirect, so we can't just // build a ProxyStatistics and loo...
c163332
} if e.ConntrackLocalLocked() { // Remove local connection tracking maps for _, m := range ctmap.LocalMaps(e, option.Config.EnableIPv4, option.Config.EnableIPv6) { ctPath, err := m.Path() if err == nil { err = os.RemoveAll(ctPath) } if err != nil { errors = append(errors, fmt.Errorf("unable t...
c163333
return loader.DeleteDatapath(context.TODO(), e.IfName, "ingress") }
c163334
e.UnconditionalLock() e.ctCleaned = true e.Unlock() }
c163335
if e.IPv4.IsSet() { keys = append(keys, lxcmap.NewEndpointKey(e.IPv4.IP())) } return keys }
c163336
MAC: %v", err) } info := &lxcmap.EndpointInfo{ IfIndex: uint32(e.IfIndex), // Store security identity in network byte order so it can be // written into the packet without an additional byte order // conversion. LxcID: e.ID, MAC: lxcmap.MAC(mac), NodeMAC: lxcmap.MAC(nodeMAC), } return info, n...
c163337
c.config.FailureThreshold = defaults.StatusCollectorFailureThreshold } if c.config.WarningThreshold == time.Duration(0) { c.config.WarningThreshold = defaults.StatusCollectorWarningThreshold } for i := range probes { c.spawnProbe(&probes[i]) } return c }
c163338
:= range c.staleProbes { probes[p] = c.probeStartTime[p] } return probes }
c163339
case <-c.stop: // collector is closed, stop looping return case <-time.After(interval): // keep looping } } }() }
c163340
// not return until the probe returns. This is to ensure the same probe // does not run again while it is blocked. for { select { case <-c.stop: // Collector was closed. The probe will complete in the background // and won't be restarted again. cancel() return case <-warningThreshold: // Just ...
c163341
&DeleteFqdnCache{Context: ctx, Handler: handler} }
c163342
time.Duration) *GetPolicyResolveParams { o.SetTimeout(timeout) return o }
c163343
context.Context) *GetPolicyResolveParams { o.SetContext(ctx) return o }
c163344
*http.Client) *GetPolicyResolveParams { o.SetHTTPClient(client) return o }
c163345
{ o.SetTraceSelector(traceSelector) return o }
c163346
allocator.WithMin(minID), allocator.WithSuffix(owner.GetNodeSuffix()), allocator.WithEvents(events), allocator.WithMasterKeyProtection(), allocator.WithPrefixMask(idpool.ID(option.Config.ClusterID<<identity.ClusterIDShift))) if err != nil { log.WithError(err).Fatal("Unable to initialize identity allocator")...
c163347
was cancelled: %s", ctx.Err()) } return IdentityAllocator.WaitForInitialSync(ctx) }
c163348
return nil, false, fmt.Errorf("allocator not initialized") } id, isNew, err := IdentityAllocator.Allocate(ctx, globalIdentity{lbls.LabelArray()}) if err != nil { return nil, false, err } log.WithFields(logrus.Fields{ logfields.Identity: id, logfields.IdentityLabels: lbls.String(), "isNew": ...
c163349
{ log.WithError(err2).WithFields(logrus.Fields{ logfields.Identity: id, }).Error("Failed to release identity") err = err2 } } return err }
c163350
return IdentityAllocator.WatchRemoteKVStore(backend, IdentitiesPath) }
c163351
deleteServiceLocked(key) if err != nil { return err } return nil }
c163352
err } return key.RRMap().Update(key.ToNetwork(), value) }
c163353
Ignore if entry is not found. return nil } return key.RRMap().Delete(key.ToNetwork()) }
c163354
y = y, x%y } return x }
c163355
} // Check if Generated seq fits in our array. if int(sum) > len(svcRRSeq.Idx) { return nil, fmt.Errorf("sum of normalized weights exceeds %d", len(svcRRSeq.Idx)) } // Generate the Sequence. i := uint16(0) k := uint16(0) for { j := uint16(0) for j < weights[k] { svcRRSeq.Idx[i] = k i++ j++ } ...
c163356
!= nil { return nil, fmt.Errorf("Unable to dump lb4 backends map: %s", err) } } if option.Config.EnableIPv6 { err := Backend6Map.DumpWithCallback(parseBackendEntries) if err != nil { return nil, fmt.Errorf("Unable to dump lb6 backends map: %s", err) } } for backendID, backendVal := range backendVal...
c163357
{ err = fmt.Errorf("error dumping RevNat4Map: %s", err) errors = append(errors, err) } } if option.Config.EnableIPv6 { if err := RevNat6Map.DumpWithCallback(parseRevNATEntries); err != nil { err = fmt.Errorf("error dumping RevNat6Map: %s", err) errors = append(errors, err) } } return newRevNATM...
c163358
return cache.restoreService(svc, v2Exists) }
c163359
return err } return key.RRMap().Update(key.ToNetwork(), value) }
c163360
Ignore if entry is not found. return nil } return key.RRMap().Delete(key.ToNetwork()) }
c163361
= NewBackend4Key(0) } for _, id := range backendsToRemove { backendKey.SetID(id) if err := deleteBackendLocked(backendKey); err != nil { return fmt.Errorf("Unable to delete backend with ID %d: %s", id, err) } releaseBackendID(id) log.WithField(logfields.BackendID, id).Debug("Deleted backend") } retu...
c163362
} else { svcKey = NewService6Key(svc.IP, svc.Port, 0) } cache.delete(svcKey) }
c163363
!option.Config.EnableIPv6 { ignorePrefixes = append(ignorePrefixes, "LXC_IP_") } elf.IgnoreSymbolPrefixes(ignorePrefixes) }) templateCache.Update(nodeCfg) }
c163364
filepath.Join(stateDir, defaults.TemplatesDir) err := os.RemoveAll(path) if err == nil || os.IsNotExist(err) { return nil } return &os.PathError{ Op: "failed to remove old BPF templates", Path: path, Err: err, } }
c163365
newObjectCache(dp, nodeCfg, option.Config.StateDir) }
c163366
nodeCfg, nil, nil) o.Lock() defer o.Unlock() o.baseHash = newHash }
c163367
fq, compiled := o.compileQueue[hash] if !compiled { fq = serializer.NewFunctionQueue(1) o.compileQueue[hash] = fq } return fq, compiled }
c163368
err, } } cfg.stats.bpfCompilation.Start() err = compileTemplate(ctx, templatePath) cfg.stats.bpfCompilation.End(err == nil) if err != nil { return &os.PathError{ Op: "failed to compile template program", Path: templatePath, Err: err, } } log.WithFields(logrus.Fields{ logfields.Path: ...
c163369
// Wait until the build completes. if err = fq.Wait(ctx); err != nil { scopedLog.WithError(err).Warning("Error while waiting for BPF template compilation") return "", false, fmt.Errorf("BPF template compilation failed: %s", err) } // Fetch the result of the compilation. path, ok := o.lookup(hash) if !ok { ...
c163370
templateCache.baseHash.sumEndpoint(templateCache, cfg, true) }
c163371
make(map[cacheKey]cacheValue), version: 1, } }
c163372
|| res == nil || len(res.Resources) == 0 { return nil, err } return res.Resources[0], nil }
c163373
if e != nil && e.ClusterSizeDependantInterval != nil { interval = e.ClusterSizeDependantInterval(interval) } return interval }
c163374
ok { log.Panicf("backend with name '%s' already registered", name) } registeredBackends[name] = module }
c163375
return backend.createInstance() } return nil }
c163376
upper := strings.ToUpper(under) return ciliumEnvPrefix + upper }
c163377
viper.BindEnv(optName, getEnvName(optName)) }
c163378
"" { envName = legacyEnvName } viper.BindEnv(optName, envName) }
c163379
range RegisteredOptions { keys = append(keys, k) } sort.Strings(keys) for _, k := range keys { entry.Infof(" --%s='%s'", k, viper.GetString(k)) } }
c163380
{ return filepath.Join(c.GetGlobalsDir(), common.NodeConfigFile) }
c163381
return false } } return len(c.Workloads) > 0 }
c163382
AllowLocalhostAlways: return true case AllowLocalhostAuto, AllowLocalhostPolicy: return false default: return false } }
c163383
ctTableMin := 1 << 10 // 1Ki entries ctTableMax := 1 << 24 // 16Mi entries (~1GiB of entries per map) if c.CTMapEntriesGlobalTCP < ctTableMin || c.CTMapEntriesGlobalAny < ctTableMin { return fmt.Errorf("Specified CT tables values %d/%d must exceed minimum %d", c.CTMapEntriesGlobalTCP, c.CTMapEntriesGlobalAny, c...
c163384
== 0 { absFileName, err := filepath.EvalSymlinks(fName) if err != nil { log.Warnf("Unable to read configuration file %q: %s", absFileName, err) continue } fName = absFileName } f, err = os.Stat(fName) if err != nil { log.Warnf("Unable to read configuration file %q: %s", fName, err) con...
c163385
fmt.Errorf("unable to read merge directory configuration: %s", err) } return nil }
c163386
newOption := range deprecatedFields { if deprecatedValue, ok := m[deprecatedOption]; ok { if _, ok := m[newOption]; !ok { m[newOption] = deprecatedValue } } } }
c163387
"body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163388
!= nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163389
!= nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163390
:= bufio.NewWriter(w) l.writeNetdevConfig(fw, cfg) return fw.Flush() }
c163391
l.writeStaticData(fw, e) return l.writeTemplateConfig(fw, e) }
c163392
:= bufio.NewWriter(w) return l.writeTemplateConfig(fw, e) }
c163393
i.Source { case ipcache.FromKVStore, ipcache.FromAgentLocal: // Cannot delete from map during callback because DumpWithCallback // RLocks the map. keysToRemove[keyToIP] = k } } } }
c163394
logfields.BPFMapPath: realizedPath, }).Warningf("Unable to recover during error renaming map paths") } }
c163395
} if err := os.Rename(pendingPath, realizedPath); err != nil { handleMapShuffleFailure(backup, realized) return fmt.Errorf("Unable to shift ipcache into new location: %s", err) } return nil }
c163396
for inconsistencies in the data-path with that in the agent to ensure // consistent state. controller.NewManager().UpdateController("ipcache-bpf-garbage-collection", controller.ControllerParams{ DoFunc: l.garbageCollect, RunInterval: 5 * time.Minute, }, ) }
c163397
{ o.SetTimeout(timeout) return o }
c163398
*DeletePolicyParams { o.SetContext(ctx) return o }
c163399
*http.Client) *DeletePolicyParams { o.SetHTTPClient(client) return o }