route

package
v0.11.0-rc.3 Latest Latest
Warning

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

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

Documentation

Overview

Package route contains the logic to manage the routes for the internal network. It creates a new route for each pod that is created in the cluster, to route the traffic from the gateway to the correct node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignMark

func AssignMark(nodename string) int

AssignMark assigns a mark to a node.

func DeletePodKeyFromMap

func DeletePodKeyFromMap(objKey client.ObjectKey)

DeletePodKeyFromMap deletes the given pod from the map.

func EndMarkTransaction

func EndMarkTransaction()

EndMarkTransaction marks the transaction.

func FreeMark

func FreeMark(nodename string)

FreeMark frees the mark used in the firewall configuration.

func GetPodNodeFromMap

func GetPodNodeFromMap(objKey client.ObjectKey) (string, error)

GetPodNodeFromMap returns the node name of the pod with the given key.

func InitMark

func InitMark(ctx context.Context, cl client.Client, options *Options)

InitMark initializes the marks map with the marks already used in the cluster.

func NewLeftoverPodsEventHandler

func NewLeftoverPodsEventHandler() handler.EventHandler

NewLeftoverPodsEventHandler returns a new LeftoverPodsEventHandler.

func NewLeftoverPodsSource

func NewLeftoverPodsSource(src <-chan event.GenericEvent) *source.Channel

NewLeftoverPodsSource returns a new LeftoversPodSource.

func PopulatePodKeyToNodeMap

func PopulatePodKeyToNodeMap(pod *corev1.Pod)

PopulatePodKeyToNodeMap adds the given pod to the map.

func RegisterMarksFromFirewallconfigurations

func RegisterMarksFromFirewallconfigurations(fwcfgs []networkingv1alpha1.FirewallConfiguration) error

RegisterMarksFromFirewallconfigurations registers the marks used in the firewallconfigurations. It fullfills the marks map with the marks used in the firewallconfigurations and the marksreverse map with the nodename and the mark used.

func RegisterMarksFromRouteconfigurations

func RegisterMarksFromRouteconfigurations(routecfgs []networkingv1alpha1.RouteConfiguration)

RegisterMarksFromRouteconfigurations registers the marks used in the routeconfigurations. It fullfills the marks map with the marks used in the routeconfigurations and the marksreverse map with the nodename and the mark used.

func StartMarkTransaction

func StartMarkTransaction()

StartMarkTransaction starts a transaction to assign a mark to a node.

Types

type InternalNodeReconciler

type InternalNodeReconciler struct {
	client.Client
	Scheme         *runtime.Scheme
	EventsRecorder record.EventRecorder
	Options        *Options
}

InternalNodeReconciler manage InternalNode.

func NewInternalNodeReconciler

func NewInternalNodeReconciler(cl client.Client, s *runtime.Scheme,
	er record.EventRecorder, options *Options) *InternalNodeReconciler

NewInternalNodeReconciler returns a new InternalNodeReconciler.

func (*InternalNodeReconciler) Reconcile

func (r *InternalNodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile manage InternalNodes.

func (*InternalNodeReconciler) SetupWithManager

func (r *InternalNodeReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager register the InternalNodeReconciler to the manager.

type Options

type Options struct {
	Namespace string
}

Options contains the options for the route package.

type PodReconciler

type PodReconciler struct {
	client.Client
	Scheme         *runtime.Scheme
	EventsRecorder record.EventRecorder
	Options        *Options
	GenericEvents  chan event.GenericEvent
}

PodReconciler manage Pod.

func NewPodReconciler

func NewPodReconciler(cl client.Client, s *runtime.Scheme,
	er record.EventRecorder, options *Options) *PodReconciler

NewPodReconciler returns a new PodReconciler.

func (*PodReconciler) CheckLeftoverRoutes

func (r *PodReconciler) CheckLeftoverRoutes(ctx context.Context) error

CheckLeftoverRoutes lists all currently existing routeconfigurations and adds their pod to the queue if its pod does not exist anymore. This will detect routes that exist with no corresponding pod; these routes need to be deleted. We only need to do this once on startup, because in steady-state these are detected (but some stragglers could have been left behind if this controller reboots). It also populates podKeyToNode map with existing pods nodename.

func (*PodReconciler) Reconcile

func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile manage Pods.

func (*PodReconciler) SetupWithManager

func (r *PodReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager register the PodReconciler to the manager.

Jump to

Keyboard shortcuts

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