controllers

package
v0.0.0-...-5a253b8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	TunEndpointNamePrefix = "tun-endpoint-"
	NetConfigNamePrefix   = "net-config-"
)

Variables

View Source
var (
	LiqonetPostroutingChain = "LIQONET-POSTROUTING"
	LiqonetPreroutingChain  = "LIQONET-PREROUTING"
	LiqonetForwardingChain  = "LIQONET-FORWARD"
	LiqonetInputChain       = "LIQONET-INPUT"
	NatTable                = "nat"
	FilterTable             = "filter"
)

Functions

This section is empty.

Types

type RouteController

type RouteController struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme

	RouteOperator  bool
	NodeName       string
	ClientSet      *kubernetes.Clientset
	RemoteVTEPs    []string
	IsGateway      bool
	VxlanNetwork   string
	GatewayVxlanIP string
	VxlanIfaceName string
	VxlanPort      int
	IPtables       liqonetOperator.IPTables
	NetLink        liqonetOperator.NetLink
	ClusterPodCIDR string
	Configured     chan bool //channel to comunicate when the podCIDR has been set
	IsConfigured   bool      //true when the operator is configured and ready to be started
	//here we save only the rules that reference the custom chains added by us
	//we need them at deletion time
	IPTablesRuleSpecsReferencingChains map[string]liqonetOperator.IPtableRule //using a map to avoid duplicate entries. the key is the rulespec
	//here we save the custom iptables chains, this chains are added at startup time so there should not be duplicates
	//but we use a map to avoid them in case the operator crashes and then is restarted by kubernetes
	IPTablesChains map[string]liqonetOperator.IPTableChain
	//for each cluster identified by clusterID we save all the rulespecs needed to ensure communication with its pods
	IPtablesRuleSpecsPerRemoteCluster map[string][]liqonetOperator.IPtableRule
	//here we save routes associated to each remote cluster
	RoutesPerRemoteCluster map[string][]netlink.Route
	RetryTimeout           time.Duration
	// contains filtered or unexported fields
}

RouteController reconciles a TunnelEndpoint object

func (*RouteController) DeleteAllIPTablesChains

func (r *RouteController) DeleteAllIPTablesChains()

this function is called when the route-operator program is closed the errors are not checked because the function is called at exit time it cleans up all the possible resources a log message is emitted if in case of error only if the iptables binaries are missing an error is returned

func (*RouteController) InsertRoutesPerCluster

func (r *RouteController) InsertRoutesPerCluster(endpoint *netv1alpha1.TunnelEndpoint) error

func (*RouteController) Reconcile

func (r *RouteController) Reconcile(req ctrl.Request) (ctrl.Result, error)

func (*RouteController) SetupSignalHandlerForRouteOperator

func (r *RouteController) SetupSignalHandlerForRouteOperator() (stopCh <-chan struct{})

SetupSignalHandlerForRouteOperator registers for SIGTERM, SIGINT. A stop channel is returned which is closed on one of these signals.

func (*RouteController) SetupWithManager

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

func (*RouteController) ToBeProcessedByRouteOperator

func (r *RouteController) ToBeProcessedByRouteOperator(meta metav1.Object) bool

func (*RouteController) WatchConfiguration

func (r *RouteController) WatchConfiguration(config *rest.Config, gv *schema.GroupVersion)

type TunnelController

type TunnelController struct {
	client.Client
	Log                          logr.Logger
	Scheme                       *runtime.Scheme
	TunnelIFacesPerRemoteCluster map[string]int
	RetryTimeout                 time.Duration
}

TunnelController reconciles a TunnelEndpoint object

func (*TunnelController) Reconcile

func (r *TunnelController) Reconcile(req ctrl.Request) (ctrl.Result, error)

func (*TunnelController) RemoveAllTunnels

func (r *TunnelController) RemoveAllTunnels()

used to remove all the tunnel interfaces when the controller is closed it does not return an error, but just logs them, cause we can not recover from them at exit time

func (*TunnelController) SetupSignalHandlerForTunnelOperator

func (r *TunnelController) SetupSignalHandlerForTunnelOperator() (stopCh <-chan struct{})

SetupSignalHandlerForRouteOperator registers for SIGTERM, SIGINT, SIGKILL. A stop channel is returned which is closed on one of these signals.

func (*TunnelController) SetupWithManager

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

type TunnelEndpointCreator

type TunnelEndpointCreator struct {
	client.Client
	Log         logr.Logger
	Scheme      *runtime.Scheme
	DynClient   dynamic.Interface
	GatewayIP   string
	PodCIDR     string
	ServiceCIDR string

	ReservedSubnets map[string]*net.IPNet
	IPManager       liqonetOperator.IpManager
	Mutex           sync.Mutex
	IsConfigured    bool
	Configured      chan bool
	AdvWatcher      chan bool
	PReqWatcher     chan bool
	RunningWatchers bool
	RetryTimeout    time.Duration
	// contains filtered or unexported fields
}

func (*TunnelEndpointCreator) AdvertisementHandler

func (r *TunnelEndpointCreator) AdvertisementHandler(obj *unstructured.Unstructured)

func (*TunnelEndpointCreator) CreateTunnelEndpoint

func (r *TunnelEndpointCreator) CreateTunnelEndpoint(param networkParam) error

func (*TunnelEndpointCreator) GetClustersSubnets

func (r *TunnelEndpointCreator) GetClustersSubnets() (map[string]*net.IPNet, error)

it returns the subnets used by the foreign clusters get the list of all tunnelEndpoint CR and saves the address space assigned to the foreign cluster.

func (*TunnelEndpointCreator) GetConfiguration

func (r *TunnelEndpointCreator) GetConfiguration(config *configv1alpha1.ClusterConfig) (map[string]*net.IPNet, error)

func (*TunnelEndpointCreator) GetTunnelEndpoint

func (r *TunnelEndpointCreator) GetTunnelEndpoint(name string) (*netv1alpha1.TunnelEndpoint, bool, error)

func (*TunnelEndpointCreator) InitConfiguration

func (r *TunnelEndpointCreator) InitConfiguration(reservedSubnets map[string]*net.IPNet, clusterSubnets map[string]*net.IPNet) error

func (*TunnelEndpointCreator) PeeringRequestHandler

func (r *TunnelEndpointCreator) PeeringRequestHandler(obj *unstructured.Unstructured)

func (*TunnelEndpointCreator) ProcessTunnelEndpoint

func (r *TunnelEndpointCreator) ProcessTunnelEndpoint(param networkParam) error

func (*TunnelEndpointCreator) Reconcile

func (r *TunnelEndpointCreator) Reconcile(req ctrl.Request) (ctrl.Result, error)

func (*TunnelEndpointCreator) SetNetParameters

func (r *TunnelEndpointCreator) SetNetParameters(config *configv1alpha1.ClusterConfig)

func (*TunnelEndpointCreator) SetupWithManager

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

func (*TunnelEndpointCreator) UpdateConfiguration

func (r *TunnelEndpointCreator) UpdateConfiguration(reservedSubnets map[string]*net.IPNet) error

func (*TunnelEndpointCreator) UpdateSpecTunnelEndpoint

func (r *TunnelEndpointCreator) UpdateSpecTunnelEndpoint(param networkParam) error

func (*TunnelEndpointCreator) UpdateStatusTunnelEndpoint

func (r *TunnelEndpointCreator) UpdateStatusTunnelEndpoint(param networkParam) error

func (*TunnelEndpointCreator) WatchConfiguration

func (r *TunnelEndpointCreator) WatchConfiguration(config *rest.Config, gv *schema.GroupVersion)

func (*TunnelEndpointCreator) Watcher

func (d *TunnelEndpointCreator) Watcher(dynClient dynamic.Interface, gvr schema.GroupVersionResource, handler func(obj *unstructured.Unstructured), start chan bool)

Jump to

Keyboard shortcuts

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