id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c162900
&& node != nil { node, err = updateNodeAnnotation(c, node, v4CIDR, v6CIDR, v4HealthIP, v6HealthIP, v4CiliumHostIP, v6CiliumHostIP) } switch { case err == nil: return case errors.IsConflict(err): scopedLog.WithFields(logrus.Fields{ fieldRetry: n, fieldMaxRetry: maxUpdateRetries, ...
c162901
m.validateEndpointHealthStatusEnum("", "body", m); err != nil { return err } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162902
be in the synchronous part of this function to ensure that // the proxy port is never refusing connections. socket, err := listenSocket(fmt.Sprintf(":%d", r.listener.proxyPort), marker, !conf.testMode) if err != nil { delete(kafkaRedirects, key) mutex.Unlock() return nil, err } listener = &kafkaList...
c162903
identity, rejecting") return false } b, err := json.Marshal(rules.Kafka) if err != nil { flowdebug.Log(scopedLog, "Error marshalling kafka rules to apply") return false } else { flowdebug.Log(scopedLog.WithField("rule", string(b)), "Applying rule") } return req.MatchesRule(rules.Kafka) }
c162904
l.SourceEndpoint.Port } if port == 0 { // Something went wrong when identifying the endpoints. // Ignore in order to avoid polluting the stats. return } request := l.Type == accesslog.TypeRequest l.localEndpoint.UpdateProxyStatistics("kafka", port, ingress, request, l.Verdict) }
c162905
revertFunc := func() error { return dr.setRules(nil, oldRules) } return revertFunc, err }
c162906
endpointInfoRegistry, } log.WithFields(logrus.Fields{ "dnsRedirect": dr, "conf": conf, }).Debug("Creating DNS Proxy redirect") return dr, dr.setRules(nil, r.rules) }
c162907
if len(fields) != 7 { return CiliumVersion{} } cver := CiliumVersion{ Version: fields[0], Revision: fields[1], AuthorDate: fields[2], GoRuntimeVersion: fields[5], Arch: fields[6], } return cver }
c162908
if err != nil { return "", err } return base64.StdEncoding.EncodeToString(jsonBytes), nil }
c162909
:= c.Fake. Invokes(testing.NewGetAction(ciliumnetworkpoliciesResource, c.ns, name), &v2.CiliumNetworkPolicy{}) if obj == nil { return nil, err } return obj.(*v2.CiliumNetworkPolicy), err }
c162910
{ return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v2.CiliumNetworkPolicyList{ListMeta: obj.(*v2.CiliumNetworkPolicyList).ListMeta} for _, item := range obj.(*v2.CiliumNetworkPolicyList).Items { if label.Matches(labels.Set(item....
c162911
error) { return c.Fake. InvokesWatch(testing.NewWatchAction(ciliumnetworkpoliciesResource, c.ns, opts)) }
c162912
Invokes(testing.NewDeleteAction(ciliumnetworkpoliciesResource, c.ns, name), &v2.CiliumNetworkPolicy{}) return err }
c162913
data, subresources...), &v2.CiliumNetworkPolicy{}) if obj == nil { return nil, err } return obj.(*v2.CiliumNetworkPolicy), err }
c162914
models.Error) *PatchEndpointIDConfigFailed { o.Payload = payload return o }
c162915
!bytes.HasPrefix(key, rule.keyPrefix) { return false } } return true } if rule.regex != nil { for _, key := range packetMeta.Keys { if !rule.regex.Match(key) { return false } } return true } log.Debugf("No key rule specified, accepted by command match") return true }
c162916
= regexp.MustCompile(v) default: proxylib.ParseError(fmt.Sprintf("Unsupported key: %s", k), rule) } } if !commandFound { if len(br.keyExact) > 0 || len(br.keyPrefix) > 0 || br.regex != nil { proxylib.ParseError("command not specified but key was provided", rule) } else { br.empty = true ...
c162917
if magicByte >= 128 { p.parser = binary.ParserFactoryInstance.Create(p.connection) } else { p.parser = text.ParserFactoryInstance.Create(p.connection) } } return p.parser.OnData(reply, endStream, dataBuffers) }
c162918
ok { log.Panicf("workload with name '%s' already registered", name) } registeredWorkloads[name] = module }
c162919
:= registeredWorkloads[name]; ok { return workload } return nil }
c162920
{ opts, ok := registeredWorkloads[crt] if !ok { return "" } return opts.getConfig()[opt] }
c162921
rb := registeredWorkloads[WorkloadRuntimeType(cr)] cfg := rb.getConfig() keys := make([]string, 0, len(cfg)) for k := range cfg { keys = append(keys, k) } sort.Strings(keys) for _, k := range keys { crtStr = append(crtStr, fmt.Sprintf("%s=%s", k, cfg[k])) } } return strings.Join(crtStr, ",") }
c162922
range crs { v := registeredWorkloads[WorkloadRuntimeType(cr)].getConfig() strs = append(strs, fmt.Sprintf("%s%s=%s", prefix, cr, v[EpOpt])) } return strings.Join(strs, ", ") }
c162923
ok := EntitySelectorMapping[e]; ok { return selectors.Matches(ctx) } return false }
c162924
entity.Matches(ctx) { return true } } return false }
c162925
if selector, ok := EntitySelectorMapping[e]; ok { slice = append(slice, selector...) } } return slice }
c162926
endpointSelectorInit, endpointSelectorUnmanaged, NewESFromLabels(labels.NewLabel(k8sapi.PolicyLabelCluster, clusterName, labels.LabelSourceK8s)), } }
c162927
to be Proxylib (TCP) parsers, which // is registered with an empty string. portType = "" } // proxyPorts is small enough to not bother indexing it. for i := range proxyPorts { if proxyPorts[i].parserType == portType && proxyPorts[i].ingress == ingress { return &proxyPorts[i] } } return nil }
c162928
if err != nil { proxyPortsMutex.Unlock() panic(fmt.Sprintf("Can't install proxy rules for %s: %s", pp.name, err)) } } } }
c162929
p.UpdateRedirectMetrics() p.mutex.Unlock() }() return p.removeRedirect(id, wg) }
c162930
proxyPortsMutex.Lock() err := p.releaseProxyPort(listenerName) proxyPortsMutex.Unlock() if err != nil { log.WithField(fieldProxyRedirectID, id).WithError(err).Warningf("Releasing proxy port %d failed", proxyPort) } }() } revertFunc = func() error { if implRevertFunc != nil { return implReve...
c162931
node.GetInternalIPv4().String(), PortRange: fmt.Sprintf("%d-%d", p.rangeMin, p.rangeMax), } }
c162932
:= range result { metrics.ProxyRedirects.WithLabelValues(proto).Set(float64(count)) } }
c162933
models.Error) *PatchEndpointIDLabelsUpdateFailed { o.Payload = payload return o }
c162934
cached.mutex.RUnlock() return c }
c162935
c := cached.capabilities cached.mutex.RUnlock() return c }
c162936
if err != nil { return err } updateVersion(ver) return nil }
c162937
:= go_version.NewVersion(fmt.Sprintf("%s.%s", sv.Major, sv.Minor)) if err == nil { updateVersion(ver) return nil } } if err != nil { return fmt.Errorf("cannot parse k8s server version from %+v: %s", sv, err) } return fmt.Errorf("cannot parse k8s server version from %+v", sv) }
c162938
&GetEndpointID{Context: ctx, Handler: handler} }
c162939
atomic.LoadPointer(&e.logger) return (*logrus.Entry)(v) }
c162940
return e.getLogger().WithField(logfields.LogSubsys, subsystem) }
c162941
!= nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162942
{ case addressing.NodeExternalDNS, addressing.NodeExternalIP, addressing.NodeHostName, addressing.NodeInternalIP, addressing.NodeInternalDNS: default: err = fmt.Errorf("invalid Kubernetes NodeAddressType %s", convertedAddr) } return convertedAddr, err }
c162943
return c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{}) }
c162944
{ return NewID(IPv4Prefix, ip.String()) } return NewID(IPv6Prefix, ip.String()) }
c162945
idx > -1 { return PrefixType(id[:idx]), id[idx+1:] } // default prefix return CiliumLocalIdPrefix, id }
c162946
a cilium identifier") } n, err := strconv.ParseInt(id, 0, 64) if err != nil { return 0, fmt.Errorf("invalid numeric cilium id: %s", err) } return n, nil }
c162947
if err := m.validateFrontendAddress(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162948
if err := m.validateSecondaryAddresses(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162949
return NewService6Key(l3n4Addr.IP, l3n4Addr.Port, 0) } return NewService4Key(l3n4Addr.IP, l3n4Addr.Port, 0) }
c162950
besValues = append(besValues, beValue) log.WithFields(logrus.Fields{ "lbFrontend": fe, "lbBackend": beValue, }).Debug("associating frontend -> backend") } log.WithFields(logrus.Fields{ "lbFrontend": svc.FE.String(), "lbBackend": svc.BES, logfields.ServiceID: fe, logfields.Object: ...
c162951
NewRevNat6Key(uint16(svcID)), NewRevNat6Value(feL3n4Addr.IP, feL3n4Addr.Port) } return NewRevNat4Key(uint16(svcID)), NewRevNat4Value(feL3n4Addr.IP, feL3n4Addr.Port) }
c162952
svcID = loadbalancer.ID(svc4Val.RevNat) beIP = svc4Val.Address.IP() bePort = svc4Val.Port beWeight = svc4Val.Weight } feL3n4Addr := serviceKey2L3n4Addr(svcKey) beLBBackEnd := loadbalancer.NewLBBackEnd(0, loadbalancer.NONE, beIP, bePort, beWeight) feL3n4AddrID := &loadbalancer.L3n4AddrID{ L3n4Addr: *feL3...
c162953
{ return loadbalancer.NewL3n4Addr(loadbalancer.NONE, revNATV.Address.IP(), revNATV.Port) }
c162954
{ return loadbalancer.NewL3n4Addr(loadbalancer.NONE, revNATV.Address.IP(), revNATV.Port) }
c162955
:= revNATKey.(*RevNat4Key) svcID = loadbalancer.ID(revNat4Key.Key) revNat4Value := revNATValue.(*RevNat4Value) be = revNat4Value2L3n4Addr(revNat4Value) } return &loadbalancer.L3n4AddrID{L3n4Addr: *be, ID: svcID} }
c162956
backend) svcValues = append(svcValues, svcValue) log.WithFields(logrus.Fields{ "lbFrontend": svcKey, "lbBackend": svcValue, }).Debug("associating frontend -> backend") } log.WithFields(logrus.Fields{ "lbFrontend": svc.FE.String(), "lbBackend": svc.BES, logfields.ServiceID: svcKey, ...
c162957
kernels depends on this ordering. s6 = []int{net.IPv6len * 8, 0} s4 = []int{net.IPv4len * 8, 0} return }
c162958
/24) if !ip.Equal(ip.Mask(mask)) { // IPv4 with non-zeroes after the subnetwork, use full mask. mask = net.CIDRMask(32, 32) } } ipnet = &net.IPNet{IP: ip, Mask: mask} } ones, _ := ipnet.Mask.Size() key := ipnet.IP.String() + "/" + strconv.Itoa(ones) if _, found := m.Map[key]; !found { m.Map[k...
c162959
s6, s4 := GetDefaultPrefixLengths() for _, i := range s6 { policy.Egress.IPv6PrefixCount[i] = 0 policy.Ingress.IPv6PrefixCount[i] = 0 } for _, i := range s4 { policy.Egress.IPv4PrefixCount[i] = 0 policy.Ingress.IPv4PrefixCount[i] = 0 } return }
c162960
v := range cp.Egress.Map { egress = append(egress, &models.PolicyRule{ Rule: v.Prefix.String(), DerivedFromRules: v.DerivedFromRules.GetModel(), }) } return &models.CIDRPolicy{ Ingress: ingress, Egress: egress, } }
c162961
ingress CIDR prefix lengths %d/%d", l, api.MaxCIDRPrefixLengths) } return nil }
c162962
{ o.Payload = payload return o }
c162963
models.Error) *DeletePolicyInvalid { o.Payload = payload return o }
c162964
models.Error) *DeletePolicyFailure { o.Payload = payload return o }
c162965
} return fmt.Sprintf("id=%-5d flags=0x%04X ifindex=%-3d mac=%s nodemac=%s", v.LxcID, v.Flags, v.IfIndex, v.MAC, v.NodeMAC, ) }
c162966
if err := LXCMap.Update(v, info); err != nil { return err } } return nil }
c162967
EndpointFlagHost} return LXCMap.Update(key, ep) }
c162968
{ err = AddHostEntry(ip) if err == nil { return true, nil } } return false, err }
c162969
errors = append(errors, fmt.Errorf("Unable to delete key %v from %s: %s", k, bpf.MapPath(MapName), err)) } } return errors }
c162970
if endpointKey, ok := key.(*EndpointKey); ok { m[endpointKey.ToIP().String()] = info } } } if err := LXCMap.DumpWithCallback(callback); err != nil { return nil, fmt.Errorf("unable to read BPF endpoint list: %s", err) } return m, nil }
c162971
&PatchConfig{Context: ctx, Handler: handler} }
c162972
{ return &ciliumNetworkPolicies{ client: c.RESTClient(), ns: namespace, } }
c162973
time.Duration) *DeleteFqdnCacheParams { o.SetTimeout(timeout) return o }
c162974
*DeleteFqdnCacheParams { o.SetContext(ctx) return o }
c162975
{ o.SetHTTPClient(client) return o }
c162976
o.SetMatchpattern(matchpattern) return o }
c162977
time.Duration) *DeleteEndpointIDParams { o.SetTimeout(timeout) return o }
c162978
context.Context) *DeleteEndpointIDParams { o.SetContext(ctx) return o }
c162979
*http.Client) *DeleteEndpointIDParams { o.SetHTTPClient(client) return o }
c162980
string) *DeleteEndpointIDParams { o.SetID(id) return o }
c162981
nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c162982
return "Global IPv6 TCP CT map" case MapTypeIPv4AnyLocal: return "Local IPv4 non-TCP CT map" case MapTypeIPv6AnyLocal: return "Local IPv6 non-TCP CT map" case MapTypeIPv4AnyGlobal: return "Global IPv4 non-TCP CT map" case MapTypeIPv6AnyGlobal: return "Global IPv6 non-TCP CT map" } return fmt.Sprintf("Unk...
c162983
true case s1.Protocol > s2.Protocol: return false } switch { case s1.AllocatedProxyPort < s2.AllocatedProxyPort: return true case s1.AllocatedProxyPort > s2.AllocatedProxyPort: return false } return false }) }
c162984
OrchestrationIdentity: Labels{}, OrchestrationInfo: Labels{}, } }
c162985
for k, v := range o.OrchestrationIdentity { enabled[k] = v } return enabled }
c162986
{ l, found = o.OrchestrationIdentity[key] if !found { l, found = o.Custom[key] } return l, found }
c162987
o.OrchestrationIdentity { all[k] = v } for k, v := range o.OrchestrationInfo { all[k] = v } return all }
c162988
return false // No change } } // Insert or replace old label l[label.Key] = label return true }
c162989
:= range l { if _, keep := marks[k]; !keep { delete(l, k) deleted = true } } return deleted }
c162990
error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v2.CiliumEndpoint)) }) return ret, err }
c162991
{ return ciliumEndpointNamespaceLister{indexer: s.indexer, namespace: namespace} }
c162992
{ err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { ret = append(ret, m.(*v2.CiliumEndpoint)) }) return ret, err }
c162993
if !exists { return nil, errors.NewNotFound(v2.Resource("ciliumendpoint"), name) } return obj.(*v2.CiliumEndpoint), nil }
c162994
j int) bool { return eps[i].ID < eps[j].ID }) }
c162995
{ return eps[i].ID < eps[j].ID }) }
c162996
} // DumpWithCallback() must be called before buffer.String(). err := m.DumpWithCallback(cb) return buffer.String(), err }
c162997
int(unsafe.Sizeof(CtEntry{})), mapInfo[mapType].maxEntries, 0, 0, mapInfo[mapType].parser, ), mapType: mapType, define: mapInfo[mapType].bpfDefine, } return result }
c162998
action { case deleteEntry: err := purgeCtEntry6(m, currentKey, natMap) if err != nil { log.WithError(err).WithField(logfields.Key, currentKey.String()).Error("Unable to delete CT entry") } else { stats.deleted++ } default: stats.aliveEntries++ } } stats.dumpError = m.DumpReliablyWithCall...
c162999
1000000000 filter.Time = uint32(tsec) } return doGC(m, filter) }