id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c163600
out := new(FQDNSelector) in.DeepCopyInto(out) return out }
c163601
out := new(FQDNSelectorSlice) in.DeepCopyInto(out) return *out }
c163602
} out := new(K8sServiceNamespace) in.DeepCopyInto(out) return out }
c163603
if in == nil { return nil } out := new(K8sServiceSelectorNamespace) in.DeepCopyInto(out) return out }
c163604
:= new(KafkaRole) in.DeepCopyInto(out) return *out }
c163605
:= new(L7Rules) in.DeepCopyInto(out) return out }
c163606
out := new(PortProtocol) in.DeepCopyInto(out) return out }
c163607
out := new(PortRule) in.DeepCopyInto(out) return out }
c163608
out := new(PortRuleDNS) in.DeepCopyInto(out) return out }
c163609
out := new(PortRuleHTTP) in.DeepCopyInto(out) return out }
c163610
out := new(PortRuleKafka) in.DeepCopyInto(out) return out }
c163611
out := new(PortRuleL7) in.DeepCopyInto(out) return *out }
c163612
:= new(Rules) in.DeepCopyInto(out) return *out }
c163613
out := new(ServiceSelector) in.DeepCopyInto(out) return out }
c163614
out := new(ToGroups) in.DeepCopyInto(out) return out }
c163615
buffer.WriteString(flag) buffer.WriteString(",") continue } } buffer.WriteString(fmt.Sprintf("%04x,", 1<<i)) } return buffer.String() }
c163616
if !e.GetEgressPolicyEnabledLocked() { value.Flags |= SkipPolicyEgress } return &value }
c163617
error { configKey := &Key{Bits: 0} return m.Map.Update(configKey, value) }
c163618
} return &k, &v, nil }).WithCache() isNewMap, err := newMap.OpenOrCreate() if err != nil { return nil, false, err } m := &EndpointConfigMap{Map: newMap, path: path, Fd: newMap.GetFd()} return m, isNewMap, nil }
c163619
now.After(unmuteDeadline) { k8sErrMsg[errstr] = now.Add(k8sErrLogTimeout) return true } return false }
c163620
YAML // map with one field) but common usage and expectation would simply list the // CIDR ranges and IPs desired as a YAML list. In these cases we would see // this decode error. We have since changed the definition to be a simple // list of strings. case strings.Contains(errstr, "Unable to decode an event from ...
c163621
config, namesToPoll: make(map[string]struct{}), sourceRules: regexpmap.NewRegexpMap(), allRules: make(map[string]*api.Rule), cache: config.Cache, } }
c163622
} // only debug print for new names since this function is called // unconditionally, even when we insert generated rules (which aren't new) if len(newDNSNames) > 0 { log.WithFields(logrus.Fields{ "newDNSNames": newDNSNames, "alreadyExistsDNSNames": alreadyExistsDNSNames, "numRules": ...
c163623
dnsNames = append(dnsNames, name) } return dnsNames }
c163624
gen.GenerateRulesFromSources(rulesToUpdate) if len(namesMissingIPs) != 0 { log.WithField(logfields.DNSName, strings.Join(namesMissingIPs, ",")). Debug("No IPs to insert when generating DNS name selected by ToFQDN rule") } // no new rules to add, do not call AddGeneratedRules below if len(generatedRules) == 0...
c163625
gen.GenerateRulesFromSources(rulesToUpdate) if len(namesMissingIPs) != 0 { log.WithField(logfields.DNSName, strings.Join(namesMissingIPs, ",")). Debug("No IPs to insert when generating DNS name selected by ToFQDN rule") } // no new rules to add, do not call AddGeneratedRules below if len(generatedRules) == 0...
c163626
} else { // This ToFQDNs.MatchName/Pattern has not been seen before newDNSNames = append(newDNSNames, policyMatchStr) // Add this egress rule as a dependent on ToFQDNs.MatchPattern, but fixup the literal // name so it can work as a regex if err = gen.sourceRules.Add(dnsPatternAsRE, uuid); er...
c163627
if len(ToFQDN.MatchPattern) > 0 { dnsPattern := matchpattern.Sanitize(ToFQDN.MatchPattern) dnsPatternAsRE := matchpattern.ToRegexp(dnsPattern) if shouldStopManaging := gen.removeFromDNSName(dnsPatternAsRE, uuid); shouldStopManaging { noLongerManaged = append(noLongerManaged, ToFQDN.MatchPattern) ...
c163628
of rules that rely on dnsName. // Note: this isn't removing dnsName from gen.sourceRules, that is just // below. return gen.sourceRules.Remove(dnsName, uuid) }
c163629
account for an unlike race condition where this // function is called with already expired data and if other cache data // from before also expired. return (len(cacheIPs) == 0 && len(sortedNewIPs) == 0) || !sortedIPsAreEqual(sortedNewIPs, cacheIPs) }
c163630
{ o.SetTimeout(timeout) return o }
c163631
*GetIdentityParams { o.SetContext(ctx) return o }
c163632
*http.Client) *GetIdentityParams { o.SetHTTPClient(client) return o }
c163633
{ o.SetLabels(labels) return o }
c163634
&GetHello{Context: ctx, Handler: handler} }
c163635
return MAC{}, err } if len(ha) != 6 { return MAC{}, fmt.Errorf("invalid MAC address %s", s) } return MAC(ha), nil }
c163636
empty values pass all other validations return nil } o.Family = &raw if err := o.validateFamily(formats); err != nil { return err } return nil }
c163637
[]interface{}{"ipv4", "ipv6"}); err != nil { return err } return nil }
c163638
false if raw == "" { // empty values pass all other validations return nil } o.Owner = &raw return nil }
c163639
*GetIdentityIDOK { o.Payload = payload return o }
c163640
models.Error) *GetIdentityIDUnreachable { o.Payload = payload return o }
c163641
models.Error) *GetIdentityIDInvalidStorageFormat { o.Payload = payload return o }
c163642
{ o.Payload = payload return o }
c163643
if err != nil { fmt.Printf("Error: %s", err) os.Exit(1) } }
c163644
output, err := execCommand(prompt) if err != nil { fmt.Fprintf(f, fmt.Sprintf("> Error while running '%s': %s\n\n", prompt, err)) } // We deliberately continue in case there was a error but the output // produced might have useful information if strings.Contains(output, "```") || !enableMarkdown { // Already...
c163645
[]string cmd := split[0] if argc > 1 { args = split[1:] } return cmd, args }
c163646
{ o.SetTimeout(timeout) return o }
c163647
*PatchConfigParams { o.SetContext(ctx) return o }
c163648
*http.Client) *PatchConfigParams { o.SetHTTPClient(client) return o }
c163649
*PatchConfigParams { o.SetConfiguration(configuration) return o }
c163650
+ format a = append([]interface{}{""}, a...) s.Logging.Logger.Printf(format, a...) } } }
c163651
if s.Logging != nil { s.Logging.Logger.Printf(format, a...) } } }
c163652
= logging.NewLogBackend(log, "", 0) if result.Trace == TRACE_DISABLED { result.Trace = TRACE_ENABLED } return &result }
c163653
filepath.Join(ip6ConfPath, device, forwarding) return ioutil.WriteFile(path, []byte(forwardingOn), 0644) }
c163654
if err := initClient(module, nil); err != nil { log.WithError(err).Panic("Unable to initialize kvstore client") } }
c163655
:= k8sDockerLbls.GetPodNamespace(containerLbls) if ns == "" { ns = "default" } return k8s.GetPodLabels(ns, podName) }
c163656
%s", key, err) errors++ } } } // if errors have occurred, print the supported configuration keys to // the log if errors > 0 { log.Error("Supported configuration keys:") for key, val := range supportedOpts { log.Errorf(" %-12s %s", key, val.description) } return fmt.Errorf("invalid workload...
c163657
return setup(a, workloadRuntimes, opts, false) }
c163658
and updating it with new entry") delete(lb.SVCMap, oldSvc.Sha256) updateMetric.Inc() } else { addMetric.Inc() } scopedLog.Debug("adding service to loadbalancer") lb.SVCMap[svc.Sha256] = svc lb.SVCMapID[ServiceID(svc.FE.ID)] = &svc return !ok }
c163659
delete(lb.SVCMap, svc.Sha256) delete(lb.SVCMapID, ServiceID(svc.FE.ID)) deleteMetric.Inc() }
c163660
&L4Addr{Protocol: protocol, Port: number} }
c163661
return false case (l == nil) && (o == nil): return true } return l.Port == o.Port && l.Protocol == o.Protocol }
c163662
&L4Addr{ Port: l.Port, Protocol: l.Protocol, } }
c163663
&FEPort{L4Addr: NewL4Addr(protocol, portNumber)} }
c163664
(o == nil): return false case (f == nil) && (o == nil): return true } return f.L4Addr.Equals(o.L4Addr) }
c163665
log.WithField(logfields.IPAddr, addr).Debug("created new L3n4Addr") return &addr }
c163666
ip, L4Addr: *lbport}, Weight: weight, } log.WithField("backend", lbbe).Debug("created new LBBackend") return &lbbe }
c163667
copy(copyIP, a.IP) return &L3n4Addr{ IP: copyIP, L4Addr: *a.L4Addr.DeepCopy(), } }
c163668
str := []byte(fmt.Sprintf("%+v", a)) return fmt.Sprintf("%x", sha512.Sum512_256(str)) }
c163669
NewL3n4Addr(protocol, ip, portNumber) return &L3n4AddrID{L3n4Addr: *l3n4Addr, ID: id} }
c163670
*l.L3n4Addr.DeepCopy(), ID: l.ID, } }
c163671
bes = make([]LBBackEnd, beIndex) for i, lbsvcBE := range lbsvc.BES { bes[i] = lbsvcBE } lbsvc.BES = bes } if beIndex == 0 { lbsvc.BES = append(lbsvc.BES, *be) } else { lbsvc.BES[beIndex-1] = *be } } lbsvc.Sha256 = sha svcs[sha] = lbsvc return &lbsvc }
c163672
check: // https://golang.org/cmd/cgo/ e.state = C.malloc(C.size_t(unsafe.Sizeof(C.struct_read_state{}))) e.buf = C.malloc(C.size_t(e.pagesize)) }
c163673
e.pagesize, e.npages, e.lost, e.unknown, C.GoBytes(e.state, C.sizeof_struct_read_state)) }
c163674
i < e.poll.nfds; i++ { fd := int(e.poll.events[i].Fd) if event, ok := e.event[fd]; ok { event.Read(receive, lost, handleError) } } return nil }
c163675
seek into reader %d bytes", decodeSize) } _, _ = reader.Seek(0, io.SeekStart) for i := 0; i < value.NumField(); i++ { if err := binary.Read(reader, binary.LittleEndian, value.Field(i).Addr().Interface()); err != nil { return fmt.Errorf("failed to decode field %d", i) } } return nil }
c163676
return decode(r, reader) }
c163677
io.ReadSeeker) error { return decode(p, reader) }
c163678
cgroupRoot) } if err := syscall.Mount("none", cgroupRoot, mountinfo.FilesystemTypeCgroup2, 0, ""); err != nil { return fmt.Errorf("failed to mount %s: %s", cgroupRoot, err) } return nil }
c163679
fatal error, sockmap will be disabled however if err == nil { log.Infof("Mounted cgroupv2 filesystem at %s", mapRoot) } }) }
c163680
} } else { info.IPv6 = ip.String() if node.IsHostIPv6(ip) { lr.endpointInfoRegistry.FillEndpointIdentityByID(identity.ReservedIdentityHost, info) } else if !lr.endpointInfoRegistry.FillEndpointIdentityByIP(ip, info) { lr.endpointInfoRegistry.FillEndpointIdentityByID(identity.ReservedIdentityWorld, info...
c163681
// We should try to resolve if the identity belongs to reserved_host // or reserved_world. if ip != nil { lr.fillEndpointInfo(info, *ip) } else { log.Warn("Missing security identity in source endpoint info") } } }
c163682
ipstr string) { ip := net.ParseIP(ipstr) if ip != nil { lr.fillEndpointInfo(info, ip) } }
c163683
func(lr *LogRecord) { lr.Verdict = v lr.Info = info } }
c163684
lr.Timestamp = ts.UTC().Format(time.RFC3339Nano) } }
c163685
lr.IPVersion = accesslog.VersionIPV6 } p, err := strconv.ParseUint(port, 10, 16) if err == nil { lr.SourceEndpoint.Port = uint16(p) if lr.ObservationPoint == accesslog.Ingress { lr.fillIngressSourceInfo(&lr.SourceEndpoint, &ip, i.SrcIdentity) } } } ipstr, port, err = net.SplitHostPor...
c163686
func(lr *LogRecord) { lr.HTTP = h } }
c163687
func(lr *LogRecord) { lr.Kafka = k } }
c163688
func(lr *LogRecord) { lr.DNS = d } }
c163689
func(lr *LogRecord) { lr.L7 = h } }
c163690
lr.Metadata = metadata if notifier != nil { notifier.NewProxyLogRecord(lr) } if logger == nil { flowdebug.Log(log.WithField(FieldFilePath, logPath), "Skipping writing to access log (logger nil)") return } if _, err := logger.Write(lr.getRawLogMessage()); err != nil { log.WithError(err).WithField(Fie...
c163691
MaxBackups: 3, MaxAge: 28, //days Compress: true, // disabled by default } return nil }
c163692
defer logMutex.Unlock() return openLogfileLocked(lf) }
c163693
modelStatus.Health, State: string(modelStatus.State), Policy: e.getEndpointPolicy(), // Scheduled for deprecation in 1.5 // // Status is deprecated but we have some users depending on // these fields so they continue to be populated until version // 1.5 Status: &cilium_v...
c163694
time.Duration) *GetMapNameParams { o.SetTimeout(timeout) return o }
c163695
*GetMapNameParams { o.SetContext(ctx) return o }
c163696
o.SetHTTPClient(client) return o }
c163697
{ o.SetName(name) return o }
c163698
!= nil { result.Family = bpf.EndpointKeyIPv4 copy(result.SIP[:], dip4) } else { result.Family = bpf.EndpointKeyIPv6 copy(result.DIP[:], dip) } result.DPort = dport result.SPort = sport return result }
c163699
&DeletePolicy{Context: ctx, Handler: handler} }