id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c163700
svc.ObjectMeta.Name, Namespace: svc.ObjectMeta.Namespace, } }
c163701
default: scopedLog.Warn("Ignoring k8s service: unsupported type") return svcID, nil } if svc.Spec.ClusterIP == "" { return svcID, nil } clusterIP := net.ParseIP(svc.Spec.ClusterIP) headless := false if strings.ToLower(svc.Spec.ClusterIP) == "none" { headless = true } svcInfo := NewService(clusterIP, ...
c163702
fmt.Sprintf("%s/%s", s.Namespace, s.Name) }
c163703
^idx1+1 ^ idx1+1+idx2 svc.Namespace = dn[idx1+1 : idx1+1+idx2] } else { // "cilium-etcd-client.kube-system" // ^idx1+1 svc.Namespace = dn[idx1+1:] } return &svc } return nil }
c163704
} return fmt.Sprintf("frontend:%s/ports=%s/selector=%v", s.FrontendIP.String(), ports, s.Selector) }
c163705
for portName, port := range s.Ports { oPort, ok := o.Ports[portName] if !ok { return false } if !port.EqualsIgnoreID(oPort) { return false } } return true } return false }
c163706
FrontendIP: ip, IsHeadless: headless, Ports: map[loadbalancer.FEPortName]*loadbalancer.FEPort{}, Labels: labels, Selector: selector, } }
c163707
uniqPorts := map[uint16]bool{} for _, p := range s.Ports { uniqPorts[p.Port] = true } return uniqPorts }
c163708
portConfig[string(portName)] = port.L4Addr } svc.Frontends = map[string]service.PortConfiguration{} svc.Frontends[k8sService.FrontendIP.String()] = portConfig svc.Backends = map[string]service.PortConfiguration{} for ipString, portConfig := range k8sEndpoints.Backends { svc.Backends[ipString] = portConfig }...
c163709
if !ok || !port1.Equals(port2) { return false } } return true }
c163710
backwards compatibility return path.Join(s.Cluster, s.Namespace, s.Name) }
c163711
"") if err := json.Unmarshal(data, &newService); err != nil { return err } *s = newService return nil }
c163712
map[string]PortConfiguration{}, Labels: map[string]string{}, Selector: map[string]string{}, } }
c163713
return nil, err } label, _, _ := testing.ExtractFromListOptions(opts) if label == nil { label = labels.Everything() } list := &v2.CiliumEndpointList{ListMeta: obj.(*v2.CiliumEndpointList).ListMeta} for _, item := range obj.(*v2.CiliumEndpointList).Items { if label.Matches(labels.Set(item.Labels)) { list...
c163714
error) { return c.Fake. InvokesWatch(testing.NewWatchAction(ciliumendpointsResource, c.ns, opts)) }
c163715
_, err := c.Fake. Invokes(testing.NewDeleteAction(ciliumendpointsResource, c.ns, name), &v2.CiliumEndpoint{}) return err }
c163716
rule.Labels.Get(uuidLabelSearchKey) }
c163717
uuid.NewUUID().String(), labels.LabelSourceCiliumGenerated) }
c163718
if len(egressRule.ToFQDNs) > 0 { egressRule.ToCIDRSet = nil } } }
c163719
if len(egressRule.ToFQDNs) > 0 { return true } } return false }
c163720
when they were // inserted in this function, previously. // If any IPs at the same index differ, updated = true. for i := range a { if !a[i].Equal(b[i]) { return false } } return true }
c163721
continue } entries[item] = true result = append(result, item) } return result }
c163722
err := r.EndpointSelector.sanitize(); err != nil { return err } for i := range r.Ingress { if err := r.Ingress[i].sanitize(); err != nil { return err } } for i := range r.Egress { if err := r.Egress[i].sanitize(); err != nil { return err } } return nil }
c163723
cidrNet.Mask.String()) } // Ensure that each provided exception CIDR prefix is formatted correctly, // and is contained within the CIDR prefix to/from which we want to allow // traffic. for _, p := range c.ExceptCIDRs { exceptCIDRAddr, _, err := net.ParseCIDR(string(p)) if err != nil { return 0, err ...
c163724
{ res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163725
} if err := m.validateRealized(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163726
models.Error) *DeleteIPAMIPFailure { o.Payload = payload return o }
c163727
resolveAgentType(n.Type), n.Text) }
c163728
Labels: labels, Revision: revision, RuleCount: numRules, } repr, err := json.Marshal(notification) return string(repr), err }
c163729
Labels: labels, Revision: revision, RuleCount: deleted, } repr, err := json.Marshal(notification) return string(repr), err }
c163730
!= nil { notification.Error = err.Error() } repr, err := json.Marshal(notification) return string(repr), err }
c163731
:= json.Marshal(notification) return string(repr), err }
c163732
ctx, recv: make(chan *envoy_api_v2.DiscoveryRequest, recvSize), sent: make(chan *envoy_api_v2.DiscoveryResponse, sentSize), recvTimeout: recvTimeout, sentTimeout: sentTimeout, } }
c163733
proxyID := e.ProxyID(l4Filter) return e.realizedRedirects[proxyID] }
c163734
// Publish the updated policy to L7 proxies. var desiredL4Policy *policy.L4Policy if e.desiredPolicy != nil { desiredL4Policy = e.desiredPolicy.L4Policy } return owner.UpdateNetworkPolicy(e, desiredL4Policy, *e.prevIdentityCache, e.desiredPolicy.DeniedIngressIdentities, e.desiredPolicy.DeniedEgressIdentities, pr...
c163735
logfields.DesiredPolicyRevision: e.nextPolicyRevision, }) }
c163736
!= nil { if e.desiredPolicy.L4Policy.RequiresConntrack() { opts[option.Conntrack] = option.OptionEnabled } } optsChanged = e.applyOptsLocked(opts) return }
c163737
synchronizing endpoint BPF program directories: %s", err) } // Keep PolicyMap for this endpoint in sync with desired / realized state. if !option.Config.DryMode { e.syncPolicyMapController() } e.realizedBPFConfig = e.desiredBPFConfig // Set realized state to desired state fields. e.realizedPolicy.Realizes(...
c163738
var buildSuccess bool var regenError error select { case result, ok := <-resChan: if ok { regenResult := result.(*EndpointRegenerationResult) regenError = regenResult.err buildSuccess = regenError == nil } else { // This may be unnecessary(?) since 'closing' of the results // channe...
c163739
:= ipcache.UpsertIPToKVStore(ctx, IP, hostIP, ID, key, metadata); err != nil { return fmt.Errorf("unable to add endpoint IP mapping '%s'->'%d': %s", IP.String(), ID, err) } return nil }, StopFunc: func(ctx context.Context) error { ip := endpointIP.String() if err := ipcache.DeleteIPFromKVSto...
c163740
updated, propagate change to key-value store // of IP to identity mapping. e.runIPIdentitySync(e.IPv4) e.runIPIdentitySync(e.IPv6) if oldIdentity != identity.StringID() { e.getLogger().WithFields(logrus.Fields{ logfields.Identity: identity.StringID(), logfields.OldIdentity: oldIdentity, logfie...
c163741
e.desiredPolicy.CIDRPolicy == nil { return policy.GetDefaultPrefixLengths() } return e.desiredPolicy.CIDRPolicy.ToBPFData() }
c163742
EnableIPv6: option.Config.EnableIPv6, EnableEncapsulation: option.Config.Tunnel != option.TunnelDisabled, EnableAutoDirectRouting: option.Config.EnableAutoDirectRouting, EnableLocalNodeRoute: enableLocalNodeRoute(), AuxiliaryPrefixes: auxPrefixes, EnableIPSec: op...
c163743
n.Registrar.RegisterNode(&n.LocalNode, n.Manager); err != nil { log.WithError(err).Error("Unable to initialize local node. Retrying...") time.Sleep(time.Second) } else { break } } close(n.Registered) }() go func() { select { case <-n.Registered: case <-time.NewTimer(defaults.NodeInitTime...
c163744
:= logrus.New() logger.Formatter = setupFormatter() return logger }
c163745
logger { case Syslog: valuesToValidate := getLogDriverConfig(Syslog, logOpts) err := validateOpts(Syslog, valuesToValidate, syslogOpts) if err != nil { return err } setupSyslog(valuesToValidate, tag, debug) default: return fmt.Errorf("provided log driver %q is not a supported log driver", log...
c163746
syslog hook. h, err := logrus_syslog.NewSyslogHook("", "", syslogLevelMap[level], tag) if err != nil { DefaultLogger.Fatal(err) } // TODO: switch to a per-logger version when we upgrade to logrus >1.0.3 logrus.AddHook(h) }
c163747
true default: fileFormat.TimestampFormat = time.RFC3339 } // TODO: switch to a per-logger version when we upgrade to logrus >1.0.3 return fileFormat }
c163748
return fmt.Errorf("provided configuration value %q is not supported as a logging option for log driver %s", k, logDriver) } } return nil }
c163749
err != nil { DefaultLogger.Fatal(err) } if ok { keysToValidate[k] = v } } return keysToValidate }
c163750
:= bufio.NewScanner(bytes.NewReader([]byte(output))) for scanner.Scan() { logFn(scanner.Text()) } }
c163751
return GetLevel(logger) >= level }
c163752
{ return logrus.Level(atomic.LoadUint32((*uint32)(&logger.Level))) }
c163753
*GetFqdnCacheOK { o.Payload = payload return o }
c163754
models.Error) *GetFqdnCacheBadRequest { o.Payload = payload return o }
c163755
} if err := m.validateIPAM(formats); err != nil { res = append(res, err) } if err := m.validateKubernetes(formats); err != nil { res = append(res, err) } if err := m.validateKvstore(formats); err != nil { res = append(res, err) } if err := m.validateNodeMonitor(formats); err != nil { res = append(re...
c163756
err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163757
err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163758
err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163759
err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163760
{ o.SetTimeout(timeout) return o }
c163761
*GetEndpointIDParams { o.SetContext(ctx) return o }
c163762
{ o.SetHTTPClient(client) return o }
c163763
string) *GetEndpointIDParams { o.SetID(id) return o }
c163764
time.Duration) *GetServiceParams { o.SetTimeout(timeout) return o }
c163765
*GetServiceParams { o.SetContext(ctx) return o }
c163766
o.SetHTTPClient(client) return o }
c163767
*PutPolicyOK { o.Payload = payload return o }
c163768
models.Error) *PutPolicyInvalidPolicy { o.Payload = payload return o }
c163769
models.Error) *PutPolicyInvalidPath { o.Payload = payload return o }
c163770
{ o.Payload = payload return o }
c163771
false if raw == "" { // empty values pass all other validations return nil } o.Matchpattern = &raw return nil }
c163772
EndpointKey: bpf.NewEndpointKey(ip), } }
c163773
return writeEndpoint(keys, pm.GetFd()) }
c163774
{ res = append(res, err) } if err := m.validateNodeMonitor(formats); err != nil { res = append(res, err) } if err := m.validateRealized(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163775
{ res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163776
o.Payload = payload return o }
c163777
func(i, j int) bool { return ls[i].Key < ls[j].Key }) return ls }
c163778
array[i] = ParseLabel(labels[i]) } return array.Sort() }
c163779
array[i] = ParseSelectLabel(labels[i]) } return array.Sort() }
c163780
array[i] = ParseLabel(base[i]) } return array.Sort() }
c163781
array[i] = ParseSelectLabel(base[i]) } return array.Sort() }
c163782
lbls[l.Key] = l } return lbls }
c163783
continue nextLabel } } missing = append(missing, needed[i]) } return missing }
c163784
o := make(LabelArray, len(ls), len(ls)) copy(o, ls) return o }
c163785
res = append(res, ls[l].String()) } return res }
c163786
FromSource: Uint16Flags{}, ToDst: Uint16Flags{}, Related: Uint16Flags{}, Verbose: false, JSONOutput: false, Verbosity: verbosity, } }
c163787
{ case INFO: dn.DumpInfo(data) case JSON: dn.DumpJSON(data, prefix) default: fmt.Println(msgSeparator) dn.DumpVerbose(!m.Hex, data, prefix) } } }
c163788
{ case INFO: tn.DumpInfo(data) case JSON: tn.DumpJSON(data, prefix) default: fmt.Println(msgSeparator) tn.DumpVerbose(!m.Hex, data, prefix) } } }
c163789
{ switch m.Verbosity { case INFO: dm.DumpInfo(data) case JSON: dm.DumpJSON(prefix) default: dm.Dump(prefix) } } }
c163790
m.Verbosity { case INFO: dc.DumpInfo(data) case JSON: dc.DumpJSON(data, prefix) default: fmt.Println(msgSeparator) dc.DumpVerbose(!m.Hex, data, prefix) } } }
c163791
if m.match(monitorAPI.MessageTypeAccessLog, uint16(lr.SourceEndpoint.ID), uint16(lr.DestinationEndpoint.ID)) { if m.Verbosity == JSON { lr.DumpJSON() } else { lr.DumpInfo() } } }
c163792
} if m.match(monitorAPI.MessageTypeAgent, 0, 0) { if m.Verbosity == JSON { an.DumpJSON() } else { an.DumpInfo() } } }
c163793
case monitorAPI.MessageTypeAccessLog: m.logRecordEvents(prefix, data) case monitorAPI.MessageTypeAgent: m.agentEvents(prefix, data) default: fmt.Printf("%s Unknown event: %+v\n", prefix, data) } }
c163794
case payload.RecordLost: LostEvent(pl.Lost, pl.CPU) default: return false } return true }
c163795
}, } rules, err := cnp.Parse() if err != nil { return nil, fmt.Errorf("Cannot parse policies: %s", err) } derivativeCNP.Specs = make(api.Rules, len(rules)) for i, rule := range rules { if rule.RequiresDerivative() { derivativeCNP.Specs[i] = denyEgressRule() } } for i, rule := range rules { if !...
c163796
&PostIPAM{Context: ctx, Handler: handler} }
c163797
OrchestrationIdentity: labels.NewLabelsFromModel(base.SecurityRelevant), OrchestrationInfo: labels.NewLabelsFromModel(base.Derived), } }
c163798
== "" { id.LabelsSHA256 = id.Labels.SHA256Sum() } return id.LabelsSHA256 }
c163799
lbls = lblArray.Labels() } return &Identity{ID: id, Labels: lbls, LabelArray: lblArray} }