Documentation
¶
Index ¶
- Constants
- Variables
- func InjectCiliumEnvoyFilters(meta *metav1.ObjectMeta, spec *cilium_v2.CiliumEnvoyConfigSpec) bool
- func NewCECTable(db *statedb.DB) (statedb.RWTable[*CEC], error)
- func NewEnvoyResourcesTable(db *statedb.DB) (statedb.RWTable[*EnvoyResource], error)
- func UseOriginalSourceAddress(meta *metav1.ObjectMeta) bool
- type CEC
- type CECConfig
- type CECName
- type CECResourceParser
- type EnvoyResource
- func (r *EnvoyResource) Clone() *EnvoyResource
- func (r *EnvoyResource) ClusterServiceName() loadbalancer.ServiceName
- func (r *EnvoyResource) GetStatus() reconciler.Status
- func (r *EnvoyResource) Key() index.Key
- func (r *EnvoyResource) SetStatus(newStatus reconciler.Status) *EnvoyResource
- func (*EnvoyResource) TableHeader() []string
- func (r *EnvoyResource) TableRow() []string
- type EnvoyResourceName
- type EnvoyResourceOrigin
- type FeatureMetrics
- type Metrics
- type PortAllocator
Constants ¶
const ( EnvoyResourceOriginCEC = EnvoyResourceOrigin("cec") EnvoyResourceOriginBackendSync = EnvoyResourceOrigin("backendsync") )
const (
CECTableName = "ciliumenvoyconfigs"
)
const (
EnvoyResourcesTableName = "envoy-resources"
)
Variables ¶
var ( CECByName = cecNameIndex.Query CECByServiceName = cecServiceIndex.Query )
var ( EnvoyResourceByName = envoyResourceNameIndex.Query EnvoyResourceByOrigin = envoyResourceOriginIndex.Query )
var ( // Cell implements handling of the Cilium(Clusterwide)EnvoyConfig handling // and backend synchronization towards Envoy. Cell = cell.Module( "ciliumenvoyconfig", "CiliumEnvoyConfig handling", cell.Config(CECConfig{}), cell.ProvidePrivate( newPolicyTrigger, func(xds envoy.XDSServer) resourceMutator { return xds }, ), cell.Provide( newCECResourceParser, newPortAllocator, ), tableCells, controllerCells, ) )
Functions ¶
func InjectCiliumEnvoyFilters ¶ added in v1.18.0
func InjectCiliumEnvoyFilters(meta *metav1.ObjectMeta, spec *cilium_v2.CiliumEnvoyConfigSpec) bool
InjectCiliumEnvoyFilters returns true if the given object indicates that Cilium Envoy Network- and L7 filters should be added to all non-internal Listeners. This can be an explicit annotation or the implicit presence of a L7LB service via the Services property.
func NewEnvoyResourcesTable ¶ added in v1.18.0
func UseOriginalSourceAddress ¶ added in v1.18.0
func UseOriginalSourceAddress(meta *metav1.ObjectMeta) bool
UseOriginalSourceAddress returns true if the given object metadata indicates that the owner needs the Envoy listener to assume the identity of Cilium Ingress. This can be an explicit annotation (or deprecated label) or the presence of an OwnerReference of Kind "Ingress" or "Gateway".
Types ¶
type CEC ¶ added in v1.17.0
type CEC struct {
Name k8sTypes.NamespacedName
Spec *ciliumv2.CiliumEnvoyConfigSpec
Labels map[string]string
Selector labels.Selector `json:"-" yaml:"-"`
SelectsLocalNode bool
Listeners part.Map[string, uint16]
ServicePorts map[loadbalancer.ServiceName]sets.Set[string] `json:"-" yaml:"-"`
// Resources is the parsed envoy.Resources with the endpoints filled in.
Resources envoy.Resources
}
CEC is the agent model of the parsed Cilium(Clusterwide)EnvoyConfig. These are stored in the 'ciliumenvoyconfigs' table that can be inspected with "db/show ciliumenvoyconfigs" in "cilium-dbg shell".
func (*CEC) TableHeader ¶ added in v1.17.0
type CECName ¶ added in v1.17.0
type CECName = k8sTypes.NamespacedName
type CECResourceParser ¶ added in v1.18.0
type CECResourceParser struct {
// contains filtered or unexported fields
}
func (*CECResourceParser) ParseResources ¶ added in v1.18.0
func (r *CECResourceParser) ParseResources(cecNamespace string, cecName string, xdsResources []cilium_v2.XDSResource, isL7LB bool, injectCiliumEnvoyFilters bool, useOriginalSourceAddr bool, newResources bool) (envoy.Resources, error)
ParseResources parses all supported Envoy resource types from CiliumEnvoyConfig CRD to the internal type `envoy.Resources`.
- Qualify names by prepending the namespace and name of the origin CEC to the Envoy resource names. - Validate resources - Inject Cilium specifics into the Listeners (BPF Metadata listener filter, Network filter & L7 filter) - Assign a random proxy port to Listeners that don't have an explicit address specified.
Parameters:
- `cecNamespace` and `cecName` will be prepended to the Envoy resource names.
- `xdsResources` are the resources from the CiliumEnvoyConfig or CiliumClusterwideEnvoyConfig.
- `isL7LB` defines whether these resources are used for L7 loadbalancing. If `true`, the info gets passed to the Envoy Cilium BPF Metadata listener filter on all Listeners.
- `injecCiliumEnvoyFilters` defines whether the Envoy Cilium Network- and L7 filters should always be added to all non-internal Listeners.
- `useOriginalSourceAddr` is passed to the Envoy Cilium BPF Metadata listener filter on all Listeners.
- `newResources` is passed as `true` when parsing resources that are being added or are the new version of the resources being updated, and as `false` if the resources are being removed or are the old version of the resources being updated. Only 'new' resources are validated.
type EnvoyResource ¶ added in v1.18.0
type EnvoyResource struct {
Name EnvoyResourceName
Status reconciler.Status
// Resources to reconcile with Envoy
Resources envoy.Resources
// ReconciledResources are the last resources that were successfully reconciled.
// Used when updating or deleting to compute the delta.
ReconciledResources *envoy.Resources
// Redirects are the proxy redirects to set. Redirection of services is performed after
// the resources have been reconciled to Envoy.
Redirects part.Map[loadbalancer.ServiceName, loadbalancer.ProxyRedirects]
// ReconciledRedirects are the redirects that were successfully set.
ReconciledRedirects part.Map[loadbalancer.ServiceName, loadbalancer.ProxyRedirects]
ReferencedServices part.Set[loadbalancer.ServiceName]
// ClusterReferences to CECs. Only applicable for "backendsync" resources. This is
// used to keep track of how many CECs refer to a "backendsync" resource (via service name).
// When no references remain the "backendsync" resource is deleted.
ClusterReferences clusterReferences `json:"-"`
}
EnvoyResource is either a "cec" resource created from CEC, or a "backendsync" resource created from a service that one ore more CECs refer to.
func (*EnvoyResource) Clone ¶ added in v1.18.0
func (r *EnvoyResource) Clone() *EnvoyResource
func (*EnvoyResource) ClusterServiceName ¶ added in v1.18.0
func (r *EnvoyResource) ClusterServiceName() loadbalancer.ServiceName
func (*EnvoyResource) GetStatus ¶ added in v1.18.0
func (r *EnvoyResource) GetStatus() reconciler.Status
func (*EnvoyResource) Key ¶ added in v1.18.0
func (r *EnvoyResource) Key() index.Key
func (*EnvoyResource) SetStatus ¶ added in v1.18.0
func (r *EnvoyResource) SetStatus(newStatus reconciler.Status) *EnvoyResource
func (*EnvoyResource) TableHeader ¶ added in v1.18.0
func (*EnvoyResource) TableHeader() []string
func (*EnvoyResource) TableRow ¶ added in v1.18.0
func (r *EnvoyResource) TableRow() []string
type EnvoyResourceName ¶ added in v1.18.0
type EnvoyResourceName struct {
Origin EnvoyResourceOrigin
Cluster string
Namespace string
Name string
}
EnvoyResourceName is the unique identifier for EnvoyResource. These can be created from to origins: - cec: derived from the Cilium(Clusterwide)EnvoyConfig. Name is the name of the CiliumEnvoyConfig. - backendsync: cluster load assignments derived from backends. Name is the name of the service.
func (EnvoyResourceName) String ¶ added in v1.18.0
func (n EnvoyResourceName) String() string
type EnvoyResourceOrigin ¶ added in v1.18.0
type EnvoyResourceOrigin string
func (EnvoyResourceOrigin) String ¶ added in v1.18.0
func (k EnvoyResourceOrigin) String() string
type FeatureMetrics ¶ added in v1.18.0
type FeatureMetrics interface {
AddCEC()
DelCEC()
AddCCEC()
DelCCEC()
}