Documentation
¶
Index ¶
Constants ¶
View Source
const (
AddressMatcherCIDRsName = "lrp-address-matcher-cidrs"
)
View Source
const (
LRPTableName = "localredirectpolicies"
)
Variables ¶
View Source
var Cell = cell.Module( "local-redirect-policies", "Controller for CiliumLocalRedirectPolicy", cell.Config(DefaultConfig), cell.Provide( statedb.RWTable[*LocalRedirectPolicy].ToTable, newLRPIsEnabled, newSkipLBMap, newSkipLBMapCommand, ), cell.ProvidePrivate( newLRPListerWatcher, NewLRPTable, newDesiredSkipLBTable, ), cell.Invoke( registerLRPReflector, registerLRPController, registerSkipLBReconciler, ), metrics.Metric(newControllerMetrics), cell.Provide(lrpAPI), )
Cell implements the processing of the CiliumLocalRedirectPolicy CRD. For each policy it creates a pseudo-service with suffix -local-redirect and associates to it all matching local pods as backends. The service frontends that are being redirected will then take the backends of the pseudo-service.
View Source
var DefaultConfig = Config{ AddressMatcherCIDRs: nil, }
Functions ¶
func NewLRPTable ¶
Types ¶
type Config ¶
type Config struct {
// AddressMatcherCIDRs limits which addresses can be used in a
// AddressMatcher rule to specific CIDRs. This allows global control over
// what addresses can be matched over the namespaced CiliumLocalRedirectPolicies.
AddressMatcherCIDRs []netip.Prefix `mapstructure:"lrp-address-matcher-cidrs"`
}
type LRPMetrics ¶
type LRPMetrics interface {
AddLRPConfig(loadbalancer.ServiceName)
DelLRPConfig(loadbalancer.ServiceName)
}
type LocalRedirectPolicy ¶
type LocalRedirectPolicy struct {
// ID is the parsed config name and namespace
ID lb.ServiceName
// UID is the unique identifier assigned by Kubernetes
UID types.UID
// LRPType is the type of either address matcher or service matcher policy
LRPType lrpConfigType
// FrontendType is the type for the parsed config frontend.
FrontendType frontendConfigType
// FrontendMappings is a slice of policy config frontend mappings that include
// frontend address, frontend port name, and a slice of its associated backends
FrontendMappings []feMapping
// ServiceID is the parsed service name and namespace
ServiceID lb.ServiceName
// BackendSelector is an endpoint selector generated from the parsed policy selector
BackendSelector *policytypes.LabelSelector
// BackendPorts is a slice of backend port and protocol along with the port name
BackendPorts []bePortInfo
// BackendPortsByPortName is a map indexed by port name with the value as
// a pointer to bePortInfo for easy lookup into backendPorts
BackendPortsByPortName map[lb.FEPortName]bePortInfo
// SkipRedirectFromBackend is the flag that enables/disables redirection
// for traffic matching the policy frontend(s) from the backends selected by the policy
SkipRedirectFromBackend bool
}
LocalRedirectPolicy is the internal representation of Cilium Local Redirect Policy.
func (*LocalRedirectPolicy) RedirectServiceName ¶
func (lrp *LocalRedirectPolicy) RedirectServiceName() lb.ServiceName
func (*LocalRedirectPolicy) TableHeader ¶
func (lrp *LocalRedirectPolicy) TableHeader() []string
func (*LocalRedirectPolicy) TableRow ¶
func (lrp *LocalRedirectPolicy) TableRow() []string
type TestSkipLBMap ¶
TestSkipLBMap is a SkipLBMap that the test suite can provide to override the map implementation.
Click to show internal directories.
Click to hide internal directories.