id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c163800
switch label.Source { case labels.LabelSourceCIDR, labels.LabelSourceReserved: default: return true } } return false }
c163801
anIPMatches := false for _, ip := range lookup.IPs { anIPMatches = anIPMatches || cidrMatcher(ip) IPStrings = append(IPStrings, ip.String()) } if !anIPMatches { continue } lookups = append(lookups, &models.DNSLookup{ Fqdn: lookup.Name, Ips: IPStrings, Loo...
c163802
per-host limit here if err = cache.UnmarshalJSON(data); err != nil { return nil, err } return cache, nil }
c163803
result, fmt.Errorf("no aws data available") } return getInstancesIpsFromFilter(group.AWS) }
c163804
nil, fmt.Errorf("Cannot initialize aws connector: %s", err) } cfg.Region = region cfg.LogLevel = awsLogLevel return &cfg, nil }
c163805
{ newFilter := ec2.Filter{ Name: policySecurityGroupName, Values: filter.SecurityGroupsNames, } input.Filters = append(input.Filters, newFilter) } cfg, err := initializeAWSAccount(region) if err != nil { return []net.IP{}, err } svc := ec2.New(*cfg) req := svc.DescribeInstancesRequest(input) res...
c163806
must be specified") } if c.SynchronizationInterval == 0 { c.SynchronizationInterval = option.Config.KVstorePeriodicSync } if c.Backend == nil { c.Backend = kvstore.Client() } return nil }
c163807
= "store-" + s.conf.Prefix s.controllerName = "kvstore-sync-" + s.name if err := s.listAndStartWatcher(); err != nil { return nil, err } controllers.UpdateController(s.controllerName, controller.ControllerParams{ DoFunc: func(ctx context.Context) error { return s.syncLocalKeys() }, RunInterval: ...
c163808
changed without breaking up and downgrades. return path.Join(s.conf.Prefix, key.GetKeyName()) }
c163809
up. if _, err := s.backend.UpdateIfDifferent(context.TODO(), s.keyPath(key), jsonValue, true); err != nil { return err } return nil }
c163810
} s.mutex.RUnlock() for _, key := range keys { if err := s.syncLocalKey(key); err != nil { return err } } return nil }
c163811
v := range s.sharedKeys { sharedKeysCopy[k] = v } return sharedKeysCopy }
c163812
s.localKeys[key.GetKeyName()] = key.DeepKeyCopy() s.mutex.Unlock() }
c163813
{ s.DeleteLocalKey(key) return err } return nil }
c163814
s.DeleteLocalKey(key) return err } return err }
c163815
nil { s.getLogger().WithError(err).Warning("Unable to delete key in kvstore") } s.onDelete(key) } }
c163816
keys := make([]Key, len(s.localKeys)) idx := 0 for _, key := range s.localKeys { keys[idx] = key idx++ } return keys }
c163817
keys := make([]Key, len(s.sharedKeys)) idx := 0 for _, key := range s.sharedKeys { keys[idx] = key idx++ } return keys }
c163818
} else if count < 1 { // The element is in both slices, but the sub slice // has more duplicates. result = false } else { occurences[element]-- } } return result, diff }
c163819
*GetEndpointIDConfigOK { o.Payload = payload return o }
c163820
identity %d->%d: %s\n", api.DropReason(n.SubType), n.Hash, n.DstID, n.SrcLabel, n.DstLabel, GetConnectionSummary(data[DropNotifyLen:])) }
c163821
if n.SrcLabel != 0 || n.DstLabel != 0 { fmt.Printf(", identity %d->%d", n.SrcLabel, n.DstLabel) } if n.DstID != 0 { fmt.Printf(", to endpoint %d\n", n.DstID) } else { fmt.Printf("\n") } if n.CapLen > 0 && len(data) > DropNotifyLen { Dissect(dissect, data[DropNotifyLen:]) } }
c163822
Reason: api.DropReason(n.SubType), Source: n.Source, Bytes: n.OrigLen, SrcLabel: n.SrcLabel, DstLabel: n.DstLabel, DstID: n.DstID, } }
c163823
// k8s:io.cilium.k8s.policy.serviceaccount=kube-dns // k8s:io.kubernetes.pod.namespace=kube-system // k8s:k8s-app=kube-dns // k8s:io.cilium.k8s.policy.cluster=default // k8s:eks.amazonaws.com/component=kube-dns WellKnown.add(ReservedEKSKubeDNS, []string{ "k8s:k8s-app=kube-dns", "k8s:eks.amazonaws.c...
c163824
&& id.Uint32() < MinimalNumericIdentity.Uint32() }
c163825
{ return ErrNotUserIdentity } reservedIdentities[label] = identity reservedIdentityNames[identity] = label return nil }
c163826
if ok { delete(reservedIdentities, label) delete(reservedIdentityNames, identity) } return nil }
c163827
identities = append(identities, id) } return identities }
c163828
value := range reservedIdentities { f(key, value) } }
c163829
and client transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) return New(transport, formats) }
c163830
= metrics.New(transport, formats) cli.Policy = policy.New(transport, formats) cli.Prefilter = prefilter.New(transport, formats) cli.Service = service.New(transport, formats) return cli }
c163831
{ o.SetTimeout(timeout) return o }
c163832
*GetEndpointParams { o.SetContext(ctx) return o }
c163833
*http.Client) *GetEndpointParams { o.SetHTTPClient(client) return o }
c163834
{ o.SetLabels(labels) return o }
c163835
models.Error) *PutServiceIDInvalidFrontend { o.Payload = payload return o }
c163836
models.Error) *PutServiceIDInvalidBackend { o.Payload = payload return o }
c163837
models.Error) *PutServiceIDFailure { o.Payload = payload return o }
c163838
tmpIfName := Endpoint2TempIfName(id) ipvlan, link, err := createIpvlanSlave(tmpIfName, mtu, masterDev, mode, ep) return ipvlan, link, tmpIfName, err }
c163839
&DeleteEndpointID{Context: ctx, Handler: handler} }
c163840
= append(f.finalizeFuncs, finalizeFunc) } }
c163841
models.Error) *PatchEndpointIDInvalid { o.Payload = payload return o }
c163842
models.Error) *PatchEndpointIDFailed { o.Payload = payload return o }
c163843
{ o.SetTimeout(timeout) return o }
c163844
*DeleteIPAMIPParams { o.SetContext(ctx) return o }
c163845
*http.Client) *DeleteIPAMIPParams { o.SetHTTPClient(client) return o }
c163846
string) *DeleteIPAMIPParams { o.SetIP(ip) return o }
c163847
&GetDebuginfo{Context: ctx, Handler: handler} }
c163848
A: difflib.SplitLines(stringA), B: difflib.SplitLines(stringB), FromFile: nameA, ToFile: nameB, Context: 32, } out, err := difflib.GetUnifiedDiffString(diff) if err != nil { return err.Error() } return "Unified diff:\n" + out }
c163849
return false } for k1, v1 := range m1 { if v2, ok := m2[k1]; !ok || v2 != v1 { return false } } return true }
c163850
}) if err != nil { return err } if err = store.UpdateLocalKeySync(n); err != nil { store.Close() return err } nr.SharedStore = store return nil }
c163851
return nr.SharedStore.UpdateLocalKeySync(n) }
c163852
:= new(Address) in.DeepCopyInto(out) return out }
c163853
return fmt.Errorf("Empty key not allowed") } } return nil }
c163854
*GetEndpointIDOK { o.Payload = payload return o }
c163855
models.Error) *GetEndpointIDInvalid { o.Payload = payload return o }
c163856
"", fmt.Errorf("failed to load netconf: %s", err) } return n, n.CNIVersion, nil }
c163857
we have an answer responseData.IPs = append(responseData.IPs, answer.A) responseData.TTL = ttlMin(responseData.TTL, int(answer.Hdr.Ttl)) case *dns.AAAA: DNSIPs[dnsName] = responseData // return only when we have an answer responseData.IPs = append(responseData.IPs, answer.AAAA) resp...
c163858
If unset, fall back to default value e = defaults.SockPath } return "unix://" + e }
c163859
return nil, fmt.Errorf("failed to create cilium agent client after %f seconds timeout: %s", timeout.Seconds(), err) default: } // This is an API call that we do to the cilium-agent to check // if it is up and running. _, err = c.Daemon.GetConfig(nil) if err != nil { time.Sleep(500 * time.Milli...
c163860
configureTransport(nil, tmp[0], host) httpClient := &http.Client{Transport: transport} clientTrans := runtime_client.NewWithClient(tmp[1], clientapi.DefaultBasePath, clientapi.DefaultSchemes, httpClient) return &Client{*clientapi.New(clientTrans, strfmt.Default)}, nil }
c163861
ok if msg == "" { for _, ctrl := range sr.Controllers { if ctrl.Status == nil { continue } if ctrl.Status.LastFailureMsg != "" { msg = fmt.Sprintf("controller %s: %s", ctrl.Name, ctrl.Status.LastFailureMsg) break } } } if msg == "" { fmt.Fprintf(w, "OK\n") } else { fmt.Fprintf...
c163862
{ if node.Name == sr.Cluster.Self { localNode = node } else { continue } } } if sr.IPAM != nil { var v4CIDR, v6CIDR, v4AllocRangeFmt, v6AllocRangeFmt string if localNode != nil { if v4AllocRange := localNode.PrimaryAddress.IPV4.AllocRange; v4AllocRange != "" { v4AllocRangeFmt = fmt.Spr...
c163863
err) } if err := m.validateLabels(formats); err != nil { res = append(res, err) } if err := m.validateLog(formats); err != nil { res = append(res, err) } if err := m.validateNetworking(formats); err != nil { res = append(res, err) } if err := m.validatePolicy(formats); err != nil { res = append(res...
c163864
increase on failed metrics metrics.EndpointRegenerationCount.WithLabelValues(metrics.LabelValueOutcomeFail).Inc() return } metrics.EndpointRegenerationCount.WithLabelValues(metrics.LabelValueOutcomeSuccess).Inc() sendMetrics(s, metrics.EndpointRegenerationTimeStats) }
c163865
&s.mapSync, "prepareBuild": &s.prepareBuild, logfields.BuildDuration: &s.totalTime, } for k, v := range s.datapathRealization.GetMap() { result[k] = v } return result }
c163866
epPolicyMaps.m[endpointID] = policyStatus epPolicyMaps.mutex.Unlock() endpointPolicyStatus.UpdateMetrics() }
c163867
epPolicyMaps.mutex.Unlock() epPolicyMaps.UpdateMetrics() }
c163868
range epPolicyMaps.m { policyStatus[value]++ } epPolicyMaps.mutex.Unlock() for k, v := range policyStatus { metrics.PolicyEndpointStatus.WithLabelValues(string(k)).Set(v) } }
c163869
resourceSet: resourceSet, resourceAccessTimeout: resourceAccessTimeout, } w.versionCond = sync.NewCond(&w.versionLocker) return w }
c163870
w.versionLocker.Unlock() if ctx.Err() != nil { break } subCtx, cancel := context.WithTimeout(ctx, w.resourceAccessTimeout) var err error watchLog.Debugf("getting %d resources from set", len(resourceNames)) res, err = w.resourceSet.GetResources(subCtx, typeURL, lastVersion, node, resourceNames) canc...
c163871
out := new(CiliumEndpoint) in.DeepCopyInto(out) return out }
c163872
} out := new(CiliumEndpointList) in.DeepCopyInto(out) return out }
c163873
} out := new(CiliumNetworkPolicy) in.DeepCopyInto(out) return out }
c163874
if in == nil { return nil } out := new(CiliumNetworkPolicyList) in.DeepCopyInto(out) return out }
c163875
if in == nil { return nil } out := new(CiliumNetworkPolicyNodeStatus) in.DeepCopyInto(out) return out }
c163876
if in == nil { return nil } out := new(CiliumNetworkPolicyStatus) in.DeepCopyInto(out) return out }
c163877
monitorAPI.MessageTypeNames { types[i] = k i++ } sort.Strings(types) return types }
c163878
if strings.Contains(err.Error(), "Link not found") { return nil } return err } return netlink.LinkDel(l) }) }
c163879
:= range entries { if !e.IsDir() && strings.HasPrefix(e.Name(), prefix) { ns = append(ns, e.Name()) } } return ns, nil }
c163880
// 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 kvstore configuration, see log for details") } // modify the configuration atomically after verification for key, val ...
c163881
{ err = setup(selectedBackend, opts, goOpts) }) return err }
c163882
= byteorder.NetworkToHost(n.Port).(uint16) return &n }
c163883
n.Port = byteorder.HostToNetwork(n.Port).(uint16) n.Weight = byteorder.HostToNetwork(n.Weight).(uint16) return &n }
c163884
n.Port = byteorder.NetworkToHost(n.Port).(uint16) n.Weight = byteorder.NetworkToHost(n.Weight).(uint16) return &n }
c163885
= byteorder.HostToNetwork(n.Key).(uint16) return &n }
c163886
connectionId) mutex.Unlock() }
c163887
mutex.Lock() log.SetLevel(log.DebugLevel) mutex.Unlock() } // Copy strings from C-memory to Go-memory so that the string remains valid // also after this function returns return OpenInstance(nodeID, xdsPath, npds.NewClient, accessLogPath, accesslog.NewClient) }
c163888
n.Port = byteorder.HostToNetwork(n.Port).(uint16) return &n }
c163889
= byteorder.HostToNetwork(n.Key).(uint16) return &n }
c163890
n := *v n.Port = byteorder.HostToNetwork(n.Port).(uint16) return &n }
c163891
&GetService{Context: ctx, Handler: handler} }
c163892
&PostIPAMIP{Context: ctx, Handler: handler} }
c163893
time.Duration) *GetStatusParams { o.SetTimeout(timeout) return o }
c163894
*GetStatusParams { o.SetContext(ctx) return o }
c163895
o.SetHTTPClient(client) return o }
c163896
*GetPrefilterOK { o.Payload = payload return o }
c163897
models.Error) *GetPrefilterFailure { o.Payload = payload return o }
c163898
return fmt.Errorf("failed to allocate identity for cidr %s: %s", prefix.String(), err) } id.CIDRLabel = labels.NewLabelsFromModel([]string{labels.LabelSourceCIDR + ":" + prefix.String()}) usedIdentities = append(usedIdentities, id) if isNew { allocatedIdentities[prefix.String()] = id } } for prefixS...
c163899
if err != nil { log.WithError(err).Warningf("Unable to release identity for CIDR %s. Ignoring error. Identity may be leaked", prefix.String()) } if released { IPIdentityCache.Delete(prefix.String(), FromCIDR) } } else { log.Errorf("Unable to find identity of previously used CIDR %s", prefix.St...