ciliumenvoyconfig

package
v1.19.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvoyResourceOriginCEC         = EnvoyResourceOrigin("cec")
	EnvoyResourceOriginBackendSync = EnvoyResourceOrigin("backendsync")
)
View Source
const (
	CECTableName = "ciliumenvoyconfigs"
)
View Source
const (
	EnvoyResourcesTableName = "envoy-resources"
)

Variables

View Source
var (
	CECByName = cecNameIndex.Query

	CECByServiceName = cecServiceIndex.Query
)
View Source
var (
	EnvoyResourceByName = envoyResourceNameIndex.Query

	EnvoyResourceByOrigin = envoyResourceOriginIndex.Query
)
View Source
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 NewCECTable added in v1.17.0

func NewCECTable(db *statedb.DB) (statedb.RWTable[*CEC], error)

func NewEnvoyResourcesTable added in v1.18.0

func NewEnvoyResourcesTable(db *statedb.DB) (statedb.RWTable[*EnvoyResource], error)

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) Clone added in v1.17.0

func (cec *CEC) Clone() *CEC

func (*CEC) TableHeader added in v1.17.0

func (*CEC) TableHeader() []string

func (*CEC) TableRow added in v1.17.0

func (cec *CEC) TableRow() []string

type CECConfig added in v1.18.0

type CECConfig struct {
	EnvoyConfigRetryInterval time.Duration
	EnvoyConfigTimeout       time.Duration
}

func (CECConfig) Flags added in v1.18.0

func (r CECConfig) Flags(flags *pflag.FlagSet)

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()
}

type Metrics added in v1.18.0

type Metrics struct {
	ControllerDuration metric.Histogram
}

type PortAllocator

type PortAllocator interface {
	AllocateCRDProxyPort(name string) (uint16, error)
	AckProxyPortWithReference(ctx context.Context, name string) error
	ReleaseProxyPort(name string) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL