redirectpolicy

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 35 Imported by: 2

Documentation

Overview

Package redirectpolicy defines an internal representation of the Cilium Local Redirect Policy. The structures are managed by the RedirectPolicyManager.

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"lrp-manager",
	"LRP Manager",

	cell.Provide(newLRPManager),
	cell.Provide(newLRPApiHandler),
)

Cell provides access to the Local Redirect Policy Manager.

Functions

This section is empty.

Types

type LRPConfig

type LRPConfig struct {
	// contains filtered or unexported fields
}

LRPConfig is the internal representation of Cilium Local Redirect Policy.

func Parse

func Parse(clrp *v2.CiliumLocalRedirectPolicy, sanitize bool) (*LRPConfig, error)

Parse parses the specified cilium local redirect policy spec, and returns a sanitized LRPConfig.

func (*LRPConfig) GetModel

func (config *LRPConfig) GetModel() *models.LRPSpec

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages configurations related to Local Redirect Policies that enable redirecting traffic from the specified frontend to a set of node-local backend pods selected based on the backend configuration. To do that, it keeps track of add/delete events for resources like LRP, Pod and Service. For every local redirect policy configuration, it creates a new lb.SVCTypeLocalRedirect service with a frontend that has at least one node-local backend.

func NewRedirectPolicyManager

func NewRedirectPolicyManager(svc svcManager, svcCache *k8s.ServiceCache, lpr agentK8s.LocalPodResource, epM endpointManager) *Manager

func (*Manager) AddRedirectPolicy

func (rpm *Manager) AddRedirectPolicy(config LRPConfig) (bool, error)

AddRedirectPolicy parses the given local redirect policy config, and updates internal state with the config fields.

func (*Manager) DeleteRedirectPolicy

func (rpm *Manager) DeleteRedirectPolicy(config LRPConfig) error

DeleteRedirectPolicy deletes the internal state associated with the given policy.

func (*Manager) EndpointCreated added in v1.16.0

func (rpm *Manager) EndpointCreated(ep *endpoint.Endpoint)

func (*Manager) EndpointDeleted added in v1.16.0

func (rpm *Manager) EndpointDeleted(ep *endpoint.Endpoint, conf endpoint.DeleteConfig)

func (*Manager) EndpointRestored added in v1.16.0

func (rpm *Manager) EndpointRestored(ep *endpoint.Endpoint)

func (*Manager) GetLRPs

func (rpm *Manager) GetLRPs() []*LRPConfig

func (*Manager) OnAddPod

func (rpm *Manager) OnAddPod(pod *slimcorev1.Pod)

func (*Manager) OnAddService

func (rpm *Manager) OnAddService(svcID k8s.ServiceID)

OnAddService handles Kubernetes service (clusterIP type) add events, and updates the internal state for the policy config associated with the service.

func (*Manager) OnDeletePod

func (rpm *Manager) OnDeletePod(pod *slimcorev1.Pod)

func (*Manager) OnDeleteService

func (rpm *Manager) OnDeleteService(svcID k8s.ServiceID)

OnDeleteService handles Kubernetes service deletes, and deletes the internal state for the policy config that might be associated with the service.

func (*Manager) OnUpdatePod

func (rpm *Manager) OnUpdatePod(pod *slimcorev1.Pod, needsReassign bool, ready bool)

func (*Manager) OnUpdatePodLocked

func (rpm *Manager) OnUpdatePodLocked(pod *slimcorev1.Pod, removeOld bool, upsertNew bool)

Jump to

Keyboard shortcuts

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