id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c163100
make(map[identity.NumericIdentity]*identityMetadata), observers: make(map[Observer]struct{}), } }
c163101
defer idm.mutex.Unlock() idm.add(identity) }
c163102
defer idm.mutex.Unlock() idm.remove(old) idm.add(new) }
c163103
defer idm.mutex.Unlock() idm.remove(identity) }
c163104
len(idm.identities)) for _, v := range idm.identities { identities = append(identities, &models.IdentityEndpoints{ Identity: v.identity.GetModel(), RefCount: int64(v.refCount), }) } return identities }
c163105
be able to drop that part pretty soon. if ef.Machine != elf.EM_NONE && ef.Machine != elf.EM_BPF { return nil, fmt.Errorf("unsupported ELF machine type %s", ef.Machine) } result := &ELF{ metadata: ef, log: scopedLog, } if err := result.symbols.extractFrom(ef); err != nil { return nil, fmt.Errorf("una...
c163106
} } result, err := NewELF(f, scopedLog) if err != nil { if err2 := f.Close(); err2 != nil { scopedLog.WithError(err).Warning("Failed to close ELF") } return nil, &os.PathError{ Op: "failed to parse ELF file", Path: path, Err: err, } } result.file = f return result, nil }
c163107
elf.file != nil { err = elf.file.Close() } return err }
c163108
createCNPCRD(clientset); err != nil { return err } if err := createCEPCRD(clientset); err != nil { return err } return nil }
c163109
= CustomResourceDefinitionPluralName + "." + SchemeGroupVersion.Group ) res := &apiextensionsv1beta1.CustomResourceDefinition{ ObjectMeta: metav1.ObjectMeta{ Name: CRDName, Labels: map[string]string{ CustomResourceDefinitionSchemaVersionKey: CustomResourceDefinitionSchemaVersion, }, }, Spec: apie...
c163110
{ Name: "Ingress Enforcement", Type: "boolean", Description: "Ingress enforcement in the endpoint", JSONPath: ".status.policy.ingress.enforcing", }, { Name: "Egress Enforcement", Type: "boolean", Description: "Egress enforcement in the endpoint...
c163111
*controller.Controller { return e.controllers.UpdateController(name, params) }
c163112
e.desiredPolicy.IngressPolicyEnabled = ingress e.Unlock() }
c163113
e.desiredPolicy.EgressPolicyEnabled = egress e.Unlock() }
c163114
proxy updates to complete...") err = proxyWaitGroup.Wait() if err != nil { return fmt.Errorf("proxy state changes failed: %s", err) } e.getLogger().Debug("Wait time for proxy updates: ", time.Since(start)) return nil }
c163115
option.Config.EndpointQueueSize), desiredPolicy: policy.NewEndpointPolicy(), realizedPolicy: policy.NewEndpointPolicy(), } ep.SetDefaultOpts(option.Config.Opts) ep.UpdateLogger(nil) ep.EventQueue.Run() return ep }
c163116
:= mac.ParseMAC(base.Mac) if err != nil { return nil, err } ep.LXCMAC = m } if base.HostMac != "" { m, err := mac.ParseMAC(base.HostMac) if err != nil { return nil, err } ep.NodeMAC = m } if base.Addressing != nil { if ip := base.Addressing.IPV6; ip != "" { ip6, err := addressing.NewCili...
c163117
&models.EndpointConfigurationSpec{ LabelConfiguration: lblMdl.Realized, } if e.Options != nil { spec.Options = *e.Options.GetMutableModel() } mdl := &models.Endpoint{ ID: int64(e.ID), Spec: spec, Status: &models.EndpointStatus{ // FIXME GH-3280 When we begin implementing revision numbers this will...
c163118
Bpf: models.EndpointHealthStatusBootstrap, Policy: models.EndpointHealthStatusDisabled, Connected: true, OverallHealth: models.EndpointHealthStatusDisabled, } case models.EndpointStateWaitingForIdentity: h = models.EndpointHealth{ Bpf: models.EndpointHealthStatusDisabled...
c163119
directly because getHealthModel handles removed endpoint properly e.mutex.RLock() defer e.mutex.RUnlock() return e.getHealthModel() }
c163120
on mutex directly because GetModelRLocked handles removed endpoint properly e.mutex.RLock() defer e.mutex.RUnlock() return e.GetModelRLocked() }
c163121
policyEnabled = models.EndpointPolicyEnabledIngress case e.realizedPolicy.EgressPolicyEnabled: policyEnabled = models.EndpointPolicyEnabledEgress } return policyEnabled }
c163122
return e.SecurityIdentity.Labels.GetModel() }
c163123
&& !strings.HasPrefix(v.Key, ciliumio.PolicyLabelServiceAccount) && !strings.HasPrefix(v.Key, ciliumio.PodNamespaceLabel) { k8sEPPodLabels[k] = v } } return k8sEPPodLabels }
c163124
return e.SecurityIdentity.GetLabelsSHA256() }
c163125
return e.OpLabels.IdentityLabels().GetModel() }
c163126
fmt.Sprintf("%05d", int(e.ID)) } return "global" }
c163127
if err != nil { return err.Error() } return string(b) }
c163128
optionChanged, e) > 0 _, exists := opts[option.Debug] if exists && changed { e.UpdateLogger(nil) } return changed }
c163129
epOptLib := option.GetEndpointMutableOptionLibrary() for k := range epOptLib { e.Options.SetValidated(k, opts.GetValue(k)) } } e.UpdateLogger(nil) }
c163130
nil || e.Options == nil || !e.Options.IsEnabled(option.ConntrackLocal) { return false } return true }
c163131
nil { return "", err } return base64.StdEncoding.EncodeToString(jsonBytes), nil }
c163132
:= base64.StdEncoding.DecodeString(str) if err != nil { return err } return json.Unmarshal(jsonBytes, ep) }
c163133
|| strings.HasSuffix(file.Name(), "_next") || strings.HasSuffix(file.Name(), "_next_fail") { eptsID = append(eptsID, file.Name()) } } } return eptsID }
c163134
e.logStatusLocked(typ, OK, msg) }
c163135
sts.Status.Code, "type": sts.Status.Type, logfields.EndpointState: sts.Status.State, logfields.PolicyRevision: e.policyRevision, }).Debug(msg) }
c163136
defer e.RUnlock() return e.hasLabelsRLocked(l) }
c163137
if j.Equals(&v) { found = true break } } if !found { return false } } return true }
c163138
reason}) { return fmt.Errorf("error while regenerating endpoint."+ " For more info run: 'cilium endpoint get %d'", e.ID) } return nil }
c163139
e.ContainerName = name e.Unlock() }
c163140
e.K8sNamespace e.RUnlock() return ns }
c163141
logfields.K8sPodName: e.GetK8sNamespaceAndPodNameLocked(), }) e.Unlock() }
c163142
k8sPodName := e.K8sPodName e.RUnlock() return k8sPodName }
c163143
e.GetK8sNamespaceAndPodNameLocked(); pod != "" { return pod } return e.StringID() }
c163144
logfields.K8sPodName: e.GetK8sNamespaceAndPodNameLocked(), }) e.Unlock() }
c163145
logfields.ContainerID: e.getShortContainerID(), }) e.Unlock() }
c163146
cID := e.ContainerID e.RUnlock() return cID }
c163147
e.UnconditionalRLock() defer e.RUnlock() return e.getShortContainerID() }
c163148
e.DockerEndpointID = id e.Unlock() }
c163149
e.DockerNetworkID = id e.Unlock() }
c163150
e.RUnlock() return e.DockerNetworkID }
c163151
e.DatapathMapID = id return e.PinDatapathMap() }
c163152
goto OKState } case StateRegenerating: switch toState { // Even while the endpoint is regenerating it is // possible that further changes require a new // build. In this case the endpoint is transitioned // from the regenerating state to // waiting-for-identity or waiting-to-regenerate state. case S...
c163153
attempted when a regeneration is competed, and another // regeneration has been queued in the meanwhile. So this // is expected and will not be logged as an error or warning. case StateReady: return false } case StateRegenerating: switch toState { // While still holding the build mutex, the builder /...
c163154
e.UnconditionalLock() if revision > e.proxyPolicyRevision { e.proxyPolicyRevision = revision } e.Unlock() }
c163155
keyCopy := key proxyStats = &keyCopy proxyStats.Statistics = &models.RequestResponseStatistics{ Requests: &models.MessageForwardingStatistics{}, Responses: &models.MessageForwardingStatistics{}, } e.proxyStatistics[key] = proxyStats } return proxyStats }
c163156
request { stats = proxyStats.Statistics.Requests } else { stats = proxyStats.Statistics.Responses } stats.Received++ metrics.ProxyReceived.Inc() switch verdict { case accesslog.VerdictForwarded: stats.Forwarded++ metrics.ProxyForwarded.Inc() case accesslog.VerdictDenied: stats.Denied++ metrics.Pro...
c163157
fmt.Errorf("endpoint may not be associated reserved labels") } return nil }
c163158
// StateWaitingToRegenerate after the identity resolution has been // completed e.SetStateLocked(StateWaitingForIdentity, "Triggering identity resolution due to updated identity labels") e.identityRevision++ rev = e.identityRevision } e.Unlock() if changed { e.runLabelsResolver(context.Background(), ow...
c163159
e.replaceInformationLabels(infoLabels) // replace identity labels and update the identity if labels have changed rev := e.replaceIdentityLabels(identityLabels) e.Unlock() if rev != 0 { e.runLabelsResolver(ctx, owner, rev, blocking) } }
c163160
} } } else { scopedLog.Info("Resolving identity labels (non-blocking)") } ctrlName := fmt.Sprintf("resolve-identity-%d", e.ID) e.controllers.UpdateController(ctrlName, controller.ControllerParams{ DoFunc: func(ctx context.Context) error { err := e.identityLabelsChanged(ctx, owner, myChangeRev) sw...
c163161
} e.setPolicyRevision(rev) e.Unlock() }
c163162
close(ps.ch) ps.done(now) delete(e.policyRevisionSignals, ps) default: if rev >= ps.wantedRev { close(ps.ch) ps.done(now) delete(e.policyRevisionSignals, ps) } } } }
c163163
e.policyRevisionSignals { w.done(now) close(w.ch) } e.policyRevisionSignals = map[*policySignal]bool{} }
c163164
if e.IPv6.IsSet() { ips = append(ips, e.IPv6.IP()) } return ips }
c163165
e.state == StateDisconnected || e.state == StateDisconnecting }
c163166
= bpf.ObjPin(mapFd, e.BPFIpvlanMapPath()) if err == nil { e.isDatapathMapPinned = true } return err }
c163167
func(reasons []string) { e.syncEndpointHeaderFile(owner, reasons) }, }) if err != nil { return fmt.Errorf( "Sync Endpoint header file trigger for endpoint cannot be activated: %s", err) } e.dnsHistoryTrigger = t } e.dnsHistoryTrigger.Trigger() return nil }
c163168
sorted. for idx := range httpRules1 { httpRule1, httpRule2 := httpRules1[idx], httpRules2[idx] switch { case HTTPNetworkPolicyRuleLess(httpRule1, httpRule2): return true case HTTPNetworkPolicyRuleLess(httpRule2, httpRule1): return false } } } remotePolicies1, remotePolicies2 := r1.RemoteP...
c163169
return false } // Assuming that the slices are sorted. for idx := range headers1 { header1, header2 := headers1[idx], headers2[idx] switch { case HeaderMatcherLess(header1, header2): return true case HeaderMatcherLess(header2, header1): return false } } // Elements are equal. return false }
c163170
> s2: return false } rm1 := m1.GetRangeMatch() rm2 := m2.GetRangeMatch() switch { case rm1 == nil && rm2 != nil: return true case rm1 != nil && rm2 == nil: return false case rm1 != nil && rm2 != nil: switch { case rm1.Start < rm2.Start: return true case rm1.Start > rm2.Start: return false }...
c163171
fmt.Sprintf("reason:%d dir:%d", k.Reason, k.Dir) }
c163172
return direction[k.Dir] } return direction[dirUnknown] }
c163173
fmt.Sprintf("count:%d bytes:%d", v.Count, v.Bytes) }
c163174
metrics.DropBytes.GetMetricWithLabelValues(key.DropForwardReason(), key.Direction()) } return metrics.ForwardBytes.GetMetricWithLabelValues(key.Direction()) }, val.bytesFloat()) }
c163175
characters in MatchPattern: \"%s\". Only 0-9, a-z, A-Z and ., - and * characters are allowed", s.MatchPattern) } _, err := matchpattern.Validate(s.MatchPattern) return err }
c163176
characters in MatchPattern: \"%s\". Only 0-9, a-z, A-Z and ., - and * characters are allowed", r.MatchPattern) } _, err := matchpattern.Validate(r.MatchPattern) return err }
c163177
return rule.GetAsEndpointSelectors() } return nil }
c163178
e.SetAggregatedSelectors() } return e.aggregatedSelectors }
c163179
CIDRSet)+len(e.ToServices)+len(e.ToFQDNs) == 0 }
c163180
cidrSet, err := group.GetCidrSet() if err != nil { return &EgressRule{}, err } if len(cidrSet) == 0 { return &EgressRule{}, nil } newRule.ToCIDRSet = append(e.ToCIDRSet, cidrSet...) } newRule.ToGroups = nil e.SetAggregatedSelectors() return newRule, nil }
c163181
mask == nil { ones = net.IPv6len * 8 } result.Prefixlen = getPrefixLen(ones) result.Family = bpf.EndpointKeyIPv6 copy(result.IP[:], ip) } return result }
c163182
err := m.delete(k, true) return err }
c163183
return net.IPv4len*8 + 1 } } if ipv6 { return maxPrefixLengths6 } return maxPrefixLengths4 }
c163184
&GetIdentityEndpoints{Context: ctx, Handler: handler} }
c163185
err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
c163186
Trace("GetPrefix", err, logrus.Fields{fieldPrefix: prefix, fieldKey: k, fieldValue: string(v)}) return }
c163187
Trace("ListPrefix", err, logrus.Fields{fieldPrefix: prefix, fieldNumEntries: len(v)}) return v, err }
c163188
Trace("Update", err, logrus.Fields{fieldKey: key, fieldValue: string(value), fieldAttachLease: lease}) return err }
c163189
logrus.Fields{fieldKey: key, fieldValue: string(value)}) return err }
c163190
Trace("DeletePrefix", err, logrus.Fields{fieldPrefix: prefix}) return err }
c163191
&DeleteServiceID{Context: ctx, Handler: handler} }
c163192
dynamic prefix length cm.Prefixlen=%d key.Prefixlen=%d", operation, cm.Prefixlen, key.Prefixlen) } return nil }
c163193
} log.WithField(logfields.Path, cm.path).Debugf("Inserting CIDR entry %s", cidr.String()) return bpf.UpdateElement(cm.Fd, unsafe.Pointer(&key), unsafe.Pointer(&entry), 0) }
c163194
} log.WithField(logfields.Path, cm.path).Debugf("Removing CIDR entry %s", cidr.String()) return bpf.DeleteElement(cm.Fd, unsafe.Pointer(&key)) }
c163195
return bpf.LookupElement(cm.Fd, unsafe.Pointer(&key), unsafe.Pointer(&entry)) == nil }
c163196
} err := bpf.GetNextKey(cm.Fd, unsafe.Pointer(&key), unsafe.Pointer(&keyNext)) if err != nil { return nil } out := cm.keyCidrInit(keyNext) return &out }
c163197
keyNext = cm.CIDRNext(key) if keyNext == nil { return to } key = keyNext to = append(to, key.String()) } }
c163198
} return bpf.ObjClose(cm.Fd) }
c163199
return OpenMapElems(path, prefixlen, prefixdyn, MaxEntries) }