Documentation
¶
Overview ¶
Package route contains the logic to manage the linux routing rules.
Index ¶
- Constants
- func AddRule(rule *networkingv1beta1.Rule, tableID uint32) error
- func AddTableID(tableID uint32, tableName string) error
- func CleanRoutes(routes []networkingv1beta1.Route, tableID uint32) error
- func CleanRules(rules []networkingv1beta1.Rule, tableID uint32) error
- func DeleteTableID(tableID uint32) error
- func EnsureRoutesAbsence(routes []networkingv1beta1.Route, tableID uint32) error
- func EnsureRoutesPresence(routes []networkingv1beta1.Route, tableID uint32) error
- func EnsureRuleAbsence(rule *networkingv1beta1.Rule, tableID uint32) error
- func EnsureRulePresence(rule *networkingv1beta1.Rule, tableID uint32) error
- func EnsureTableAbsence(tableID uint32) error
- func EnsureTablePresence(routeconfiguration *networkingv1beta1.RouteConfiguration, tableID uint32) error
- func ExistsRoute(route *networkingv1beta1.Route, tableID uint32) (*netlink.Route, bool, error)
- func ExistsRule(rule *networkingv1beta1.Rule, rules []netlink.Rule) (*netlink.Rule, bool, error)
- func ExistsTableID(tableID uint32) (exists bool, err error)
- func GetRulesByTableID(tableID uint32) ([]netlink.Rule, error)
- func GetTableID(tableName string) (uint32, error)
- func IsContainedRoute(route *netlink.Route, routes []networkingv1beta1.Route) bool
- func IsContainedRule(existingrule *netlink.Rule, rules []networkingv1beta1.Rule) bool
- func IsEqualRoute(route1, route2 *netlink.Route) bool
- func NewRouteWatchEventHandler(cl client.Client, labelsSets []labels.Set) handler.EventHandler
- func NewRouteWatchSource(src <-chan event.GenericEvent, eh handler.EventHandler) source.Source
- func RuleIsEqual(rule *networkingv1beta1.Rule, netlinkRule *netlink.Rule) bool
- type RouteConfigurationReconciler
- func NewRouteConfigurationReconcilerWithFinalizer(cl client.Client, s *runtime.Scheme, podname string, er record.EventRecorder, ...) (*RouteConfigurationReconciler, error)
- func NewRouteConfigurationReconcilerWithoutFinalizer(cl client.Client, s *runtime.Scheme, podname string, er record.EventRecorder, ...) (*RouteConfigurationReconciler, error)
- func (r *RouteConfigurationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *RouteConfigurationReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error
- func (r *RouteConfigurationReconciler) UpdateStatus(ctx context.Context, er record.EventRecorder, ...) error
Constants ¶
const ( // RouteCategoryTargetKey is the key used by the route controller to reconcile only resources related to a group. RouteCategoryTargetKey = "networking.liqo.io/route-category" // RouteSubCategoryTargetKey is the key used by the route controller to reconcile only resources related to a subgroup. RouteSubCategoryTargetKey = "networking.liqo.io/route-subcategory" // RouteUniqueTargetKey is the key used by the route controller to reconcile only resources related to a single component. RouteUniqueTargetKey = "networking.liqo.io/route-unique" )
const ( // RTTablesDir contains path to the directory with ID to routing tables IDs mapping in Linux. RTTablesDir = "/etc/iproute2" // RTTablesFilename contains path to the file with ID to routing tables IDs mapping in Linux. RTTablesFilename = RTTablesDir + "/rt_tables" )
Variables ¶
This section is empty.
Functions ¶
func AddRule ¶
func AddRule(rule *networkingv1beta1.Rule, tableID uint32) error
AddRule adds the given rule to the rules list.
func AddTableID ¶
AddTableID adds the given table ID to the rt_tables file.
func CleanRoutes ¶
func CleanRoutes(routes []networkingv1beta1.Route, tableID uint32) error
CleanRoutes cleans the routes that are not contained in the given route list.
func CleanRules ¶
func CleanRules(rules []networkingv1beta1.Rule, tableID uint32) error
CleanRules deletes all the rules which are not contained anymore in the given rules list.
func DeleteTableID ¶
DeleteTableID deletes the given table ID from the rt_tables file.
func EnsureRoutesAbsence ¶
func EnsureRoutesAbsence(routes []networkingv1beta1.Route, tableID uint32) error
EnsureRoutesAbsence ensures the absence of the given routes.
func EnsureRoutesPresence ¶
func EnsureRoutesPresence(routes []networkingv1beta1.Route, tableID uint32) error
EnsureRoutesPresence ensures the presence of the given routes.
func EnsureRuleAbsence ¶
func EnsureRuleAbsence(rule *networkingv1beta1.Rule, tableID uint32) error
EnsureRuleAbsence ensures the absence of the given rule.
func EnsureRulePresence ¶
func EnsureRulePresence(rule *networkingv1beta1.Rule, tableID uint32) error
EnsureRulePresence ensures the presence of the given rule.
func EnsureTableAbsence ¶
EnsureTableAbsence ensures the absence of the given table.
func EnsureTablePresence ¶
func EnsureTablePresence(routeconfiguration *networkingv1beta1.RouteConfiguration, tableID uint32) error
EnsureTablePresence ensures the presence of the given table.
func ExistsRoute ¶
ExistsRoute checks if the given route is already present in the route list.
func ExistsRule ¶
ExistsRule checks if the given rule is already present in the rules list.
func ExistsTableID ¶
ExistsTableID checks if the given table ID is already present in the rt_tables file.
func GetRulesByTableID ¶
GetRulesByTableID returns all the rules associated with the given table ID.
func GetTableID ¶
GetTableID returns the table ID associated with the given route.
func IsContainedRoute ¶
func IsContainedRoute(route *netlink.Route, routes []networkingv1beta1.Route) bool
IsContainedRoute checks if the given route is contained in the route list.
func IsContainedRule ¶
func IsContainedRule(existingrule *netlink.Rule, rules []networkingv1beta1.Rule) bool
IsContainedRule checks if the given rule is contained in the given rules list.
func IsEqualRoute ¶
IsEqualRoute checks if the two routes are equal.
func NewRouteWatchEventHandler ¶
NewRouteWatchEventHandler creates a new EventHandler.
func NewRouteWatchSource ¶
func NewRouteWatchSource(src <-chan event.GenericEvent, eh handler.EventHandler) source.Source
NewRouteWatchSource creates a new Source for the Route watcher.
func RuleIsEqual ¶
func RuleIsEqual(rule *networkingv1beta1.Rule, netlinkRule *netlink.Rule) bool
RuleIsEqual checks if the given rule is equal to the given netlink rule.
Types ¶
type RouteConfigurationReconciler ¶
type RouteConfigurationReconciler struct { PodName string client.Client Scheme *runtime.Scheme EventsRecorder record.EventRecorder // Labels used to filter the reconciled resources. LabelsSets []labels.Set // EnableFinalizer is used to enable the finalizer on the reconciled resources. EnableFinalizer bool }
RouteConfigurationReconciler manage Configuration lifecycle.
func NewRouteConfigurationReconcilerWithFinalizer ¶
func NewRouteConfigurationReconcilerWithFinalizer(cl client.Client, s *runtime.Scheme, podname string, er record.EventRecorder, labelsSets []labels.Set) (*RouteConfigurationReconciler, error)
NewRouteConfigurationReconcilerWithFinalizer initializes a reconciler that uses finalizers on routeconfigurations.
func NewRouteConfigurationReconcilerWithoutFinalizer ¶
func NewRouteConfigurationReconcilerWithoutFinalizer(cl client.Client, s *runtime.Scheme, podname string, er record.EventRecorder, labelsSets []labels.Set) (*RouteConfigurationReconciler, error)
NewRouteConfigurationReconcilerWithoutFinalizer initializes a reconciler that doesn't use finalizers on routeconfigurations.
func (*RouteConfigurationReconciler) Reconcile ¶
func (r *RouteConfigurationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile manage RouteConfigurations, applying nftables configuration.
func (*RouteConfigurationReconciler) SetupWithManager ¶
func (r *RouteConfigurationReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error
SetupWithManager register the RouteConfigurationReconciler to the manager.
func (*RouteConfigurationReconciler) UpdateStatus ¶
func (r *RouteConfigurationReconciler) UpdateStatus(ctx context.Context, er record.EventRecorder, routeconfiguration *networkingv1beta1.RouteConfiguration, podname string, err error) error
UpdateStatus updates the status of the given RouteConfiguration.