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 ¶
- func AssignMark(nodename string) int
- func DeletePodKeyFromMap(objKey client.ObjectKey)
- func EndMarkTransaction()
- func FreeMark(nodename string)
- func GetPodNodeFromMap(objKey client.ObjectKey) (string, error)
- func InitMark(ctx context.Context, cl client.Client, options *Options)
- func NewLeftoverPodsEventHandler() handler.EventHandler
- func NewLeftoverPodsSource(src <-chan event.GenericEvent) *source.Channel
- func PopulatePodKeyToNodeMap(pod *corev1.Pod)
- func RegisterMarksFromFirewallconfigurations(fwcfgs []networkingv1alpha1.FirewallConfiguration) error
- func RegisterMarksFromRouteconfigurations(routecfgs []networkingv1alpha1.RouteConfiguration)
- func StartMarkTransaction()
- type InternalNodeReconciler
- type Options
- type PodReconciler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeletePodKeyFromMap ¶
DeletePodKeyFromMap deletes the given pod from the map.
func FreeMark ¶
func FreeMark(nodename string)
FreeMark frees the mark used in the firewall configuration.
func GetPodNodeFromMap ¶
GetPodNodeFromMap returns the node name of the pod with the given key.
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 ¶
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) SetupWithManager ¶
func (r *PodReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager register the PodReconciler to the manager.