Documentation ¶
Index ¶
- Variables
- func GetDaemonAddressByPod(daemon DaemonPod) string
- func GetPluginMap(config *rest.Config) map[string]*PluginInterface
- func InitHostInterfaceCache(clientset *kubernetes.Clientset, hostInterfaceHandler *HostInterfaceHandler, ...) error
- func InitIppoolCache(ippoolHandler *IPPoolHandler) error
- func IsContainerReady(pod v1.Pod) bool
- func IsMultiNICIPAM(instance *multinicv1.MultiNicNetwork) (bool, error)
- func NetStatusUpdated(instance *multinicv1.MultiNicNetwork, ...) bool
- func RunPeriodicUpdate(ticker *time.Ticker, daemonWatcher *DaemonWatcher, cidrHandler *CIDRHandler, ...)
- func SetDaemonConnector(daemonSpec multinicv1.ConfigSpec)
- type CIDRHandler
- func (h *CIDRHandler) CleanPendingIPPools(snapshot map[string]multinicv1.IPPoolSpec, defName string, ...) map[string]multinicv1.IPPoolSpec
- func (h *CIDRHandler) DeleteCIDR(cidr multinicv1.CIDR) error
- func (h *CIDRHandler) DeleteOldRoutes(cidrSpec multinicv1.CIDRSpec)
- func (h *CIDRHandler) GenerateCIDRFromHostSubnet(def multinicv1.PluginConfig) (multinicv1.CIDRSpec, error)
- func (h *CIDRHandler) GetAllNetAddrs() []string
- func (h *CIDRHandler) GetCIDR(name string) (*multinicv1.CIDR, error)
- func (h *CIDRHandler) GetCache(key string) (multinicv1.CIDRSpec, error)
- func (h *CIDRHandler) GetHostAddressesToExclude() []string
- func (h *CIDRHandler) GetHostInterfaceIndexMap(entries []multinicv1.CIDREntry) map[string]map[int]multinicv1.HostInterfaceInfo
- func (h *CIDRHandler) GetSyncAllocations(ippool multinicv1.IPPoolSpec, ...) (bool, []multinicv1.Allocation)
- func (h *CIDRHandler) InitCustomCRCache()
- func (h *CIDRHandler) IsL3Mode(def multinicv1.PluginConfig) bool
- func (h *CIDRHandler) ListCIDR() (map[string]multinicv1.CIDR, error)
- func (h *CIDRHandler) ListCache() map[string]multinicv1.CIDRSpec
- func (h *CIDRHandler) NewCIDR(def multinicv1.PluginConfig, namespace string) (multinicv1.CIDRSpec, error)
- func (h *CIDRHandler) NewCIDRWithNewConfig(def multinicv1.PluginConfig, namespace string) (bool, error)
- func (h *CIDRHandler) ProcessUpdateRequest()
- func (h *CIDRHandler) Run()
- func (h *CIDRHandler) SetCache(key string, value multinicv1.CIDRSpec)
- func (h *CIDRHandler) SyncAllPendingCustomCR(defHandler *plugin.NetAttachDefHandler)
- func (h *CIDRHandler) SyncCIDRRoute(cidrSpec multinicv1.CIDRSpec, forceDelete bool) (status multinicv1.RouteStatus)
- func (h *CIDRHandler) SyncIPPoolWithActivePods(cidrMap map[string]multinicv1.CIDR, ...)
- func (h *CIDRHandler) UpdateCIDRs()
- func (h *CIDRHandler) UpdateEntries(cidrSpec multinicv1.CIDRSpec, excludes []compute.IPValue, changed bool) (map[string]multinicv1.CIDREntry, bool)
- type CIDRReconciler
- type ConfigReconciler
- func (r *ConfigReconciler) CreateDefaultDaemonConfig() error
- func (r *ConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *ConfigReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *ConfigReconciler) UpdateConfigBySpec(spec *multinicv1.ConfigSpec)
- type DaemonCacheHandler
- type DaemonConnector
- func (dc DaemonConnector) ApplyL3Config(podAddress string, cidrName string, subnet string, routes []HostRoute, ...) (RouteUpdateResponse, error)
- func (dc DaemonConnector) DeleteL3Config(podAddress string, cidrName string, subnet string) (RouteUpdateResponse, error)
- func (dc DaemonConnector) GetInterfaces(podAddress string) ([]multinicv1.InterfaceInfoType, error)
- func (dc DaemonConnector) Join(podAddress string, hifs []multinicv1.InterfaceInfoType) error
- type DaemonPod
- type DaemonWatcher
- type HostInterfaceHandler
- func (h *HostInterfaceHandler) CreateHostInterface(hostName string, interfaces []multinicv1.InterfaceInfoType) error
- func (h *HostInterfaceHandler) DeleteHostInterface(name string) error
- func (h *HostInterfaceHandler) GetCache(key string) (multinicv1.HostInterface, error)
- func (h *HostInterfaceHandler) GetHostInterface(name string) (*multinicv1.HostInterface, error)
- func (h *HostInterfaceHandler) GetInfoAvailableSize() int
- func (h *HostInterfaceHandler) IpamJoin(daemon DaemonPod) error
- func (h *HostInterfaceHandler) ListCache() map[string]multinicv1.HostInterface
- func (h *HostInterfaceHandler) ListHostInterface() (map[string]multinicv1.HostInterface, error)
- func (h *HostInterfaceHandler) SetCache(key string, value multinicv1.HostInterface)
- func (h *HostInterfaceHandler) UpdateHostInterface(oldObj multinicv1.HostInterface, interfaces []multinicv1.InterfaceInfoType) (*multinicv1.HostInterface, error)
- type HostInterfaceReconciler
- func (r *HostInterfaceReconciler) CallFinalizer(reqLogger logr.Logger, instance *multinicv1.HostInterface) error
- func (r *HostInterfaceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *HostInterfaceReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *HostInterfaceReconciler) UpdateInterfaces(instance multinicv1.HostInterface) error
- type HostRoute
- type IPAMInfo
- type IPPoolHandler
- func (h *IPPoolHandler) AddLabel(ippool *multinicv1.IPPool) error
- func (h *IPPoolHandler) DeleteIPPool(netAttachDef string, podCIDR string) error
- func (h *IPPoolHandler) GetCache(key string) (multinicv1.IPPoolSpec, error)
- func (h *IPPoolHandler) GetIPPool(name string) (*multinicv1.IPPool, error)
- func (h *IPPoolHandler) GetIPPoolName(netAttachDef string, podCIDR string) string
- func (h *IPPoolHandler) ListCache() map[string]multinicv1.IPPoolSpec
- func (h *IPPoolHandler) ListIPPool() (map[string]multinicv1.IPPool, error)
- func (h *IPPoolHandler) PatchIPPoolAllocations(ippoolName string, newAllocations []multinicv1.Allocation) error
- func (h *IPPoolHandler) SetCache(key string, value multinicv1.IPPoolSpec)
- func (h *IPPoolHandler) UpdateIPPool(netAttachDef string, podCIDR string, vlanCIDR string, hostName string, ...) error
- func (h *IPPoolHandler) UpdateIPPools(defName string, entries []multinicv1.CIDREntry, excludes []compute.IPValue)
- type IPPoolReconciler
- type L3ConfigRequest
- type MultiNicNetworkHandler
- func (h *MultiNicNetworkHandler) FilterNetworksByNamespace(target string) []multinicv1.MultiNicNetwork
- func (h *MultiNicNetworkHandler) GetNetwork(name string) (*multinicv1.MultiNicNetwork, error)
- func (h *MultiNicNetworkHandler) GetStatusCache(key string) (multinicv1.MultiNicNetworkStatus, error)
- func (h *MultiNicNetworkHandler) ListStatusCache() map[string]multinicv1.MultiNicNetworkStatus
- func (h *MultiNicNetworkHandler) SetCache(key string, value multinicv1.MultiNicNetwork)
- func (h *MultiNicNetworkHandler) SyncAllStatus(name string, spec multinicv1.CIDRSpec, routeStatus multinicv1.RouteStatus, ...) (multinicv1.MultiNicNetworkStatus, error)
- func (h *MultiNicNetworkHandler) UpdateNetConfigStatus(instance *multinicv1.MultiNicNetwork, ...) error
- type MultiNicNetworkReconciler
- func (r *MultiNicNetworkReconciler) GenerateNetAttachDef(instance *multinicv1.MultiNicNetwork) error
- func (r *MultiNicNetworkReconciler) GetIPAMConfig(instance *multinicv1.MultiNicNetwork) (*multinicv1.PluginConfig, error)
- func (r *MultiNicNetworkReconciler) GetMainPluginConf(instance *multinicv1.MultiNicNetwork) (string, map[string]string, error)
- func (r *MultiNicNetworkReconciler) HandleMultiNicIPAM(instance *multinicv1.MultiNicNetwork) error
- func (r *MultiNicNetworkReconciler) HandleNewNamespace(namespace string)
- func (r *MultiNicNetworkReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *MultiNicNetworkReconciler) SetupWithManager(mgr ctrl.Manager) error
- type NamespaceWatcher
- type PluginInterface
- type RouteHandler
- func (h *RouteHandler) AddRoutes(cidrSpec multinicv1.CIDRSpec, entries []multinicv1.CIDREntry, ...) (success bool, noConnection bool)
- func (h *RouteHandler) AddRoutesToHost(cidrSpec multinicv1.CIDRSpec, hostName string, daemon DaemonPod, ...) (bool, bool)
- func (h *RouteHandler) DeleteRoutes(cidrSpec multinicv1.CIDRSpec)
- type RouteUpdateResponse
- type SafeCache
Constants ¶
This section is empty.
Variables ¶
var ( OPERATOR_NAMESPACE string = getOperatorNamespace() ConfigReady bool = false // referred by daemon watcher DaemonName string = vars.DaemonLabelValue )
var DAEMON_NAMESPACE, DAEMON_PORT, INTERFACE_PATH, ADD_ROUTE_PATH, DELETE_ROUTE_PATH, REGISTER_IPAM_PATH string
var ( RouteMessage map[multinicv1.RouteStatus]string = map[multinicv1.RouteStatus]string{ multinicv1.SomeRouteFailed: "some route cannot be applied, need attention", multinicv1.RouteUnknown: "some daemon cannot be connected", multinicv1.ApplyingRoute: "waiting for route update", multinicv1.AllRouteApplied: "", } )
Functions ¶
func GetDaemonAddressByPod ¶
GetDaemonAddressByPod returns daemon IP address (pod IP:daemon port)
func GetPluginMap ¶
func GetPluginMap(config *rest.Config) map[string]*PluginInterface
func InitHostInterfaceCache ¶
func InitHostInterfaceCache(clientset *kubernetes.Clientset, hostInterfaceHandler *HostInterfaceHandler, daemonCacheHandler *DaemonCacheHandler) error
func InitIppoolCache ¶
func InitIppoolCache(ippoolHandler *IPPoolHandler) error
func IsContainerReady ¶
func IsMultiNICIPAM ¶
func IsMultiNICIPAM(instance *multinicv1.MultiNicNetwork) (bool, error)
func NetStatusUpdated ¶
func NetStatusUpdated(instance *multinicv1.MultiNicNetwork, newStatus multinicv1.MultiNicNetworkStatus) bool
func RunPeriodicUpdate ¶
func RunPeriodicUpdate(ticker *time.Ticker, daemonWatcher *DaemonWatcher, cidrHandler *CIDRHandler, hostInterfaceReconciler *HostInterfaceReconciler, quit chan struct{})
func SetDaemonConnector ¶
func SetDaemonConnector(daemonSpec multinicv1.ConfigSpec)
SetDaemon sets daemon environments
Types ¶
type CIDRHandler ¶
type CIDRHandler struct { client.Client *kubernetes.Clientset compute.CIDRCompute *HostInterfaceHandler *IPPoolHandler *MultiNicNetworkHandler sync.Mutex RouteHandler *SafeCache UpdateRequestQueue chan struct{} Quit chan struct{} // contains filtered or unexported fields }
CIDRHandler handles CIDR object - general handling: Get, List, Delete - compute VLAN CIDR and create CIDR
func NewCIDRHandler ¶
func NewCIDRHandler(client client.Client, config *rest.Config, hostInterfaceHandler *HostInterfaceHandler, daemonCache *DaemonCacheHandler, quit chan struct{}) *CIDRHandler
func (*CIDRHandler) CleanPendingIPPools ¶
func (h *CIDRHandler) CleanPendingIPPools(snapshot map[string]multinicv1.IPPoolSpec, defName string, newCIDR multinicv1.CIDRSpec) map[string]multinicv1.IPPoolSpec
CleanPendingIPPools clean ippools in case that cidr is updated with new subnet entry
func (*CIDRHandler) DeleteCIDR ¶
func (h *CIDRHandler) DeleteCIDR(cidr multinicv1.CIDR) error
DeleteCIDR deletes corresponding routes and IPPools, then deletes CIDR
func (*CIDRHandler) DeleteOldRoutes ¶
func (h *CIDRHandler) DeleteOldRoutes(cidrSpec multinicv1.CIDRSpec)
DeleteOldRoutes forcefully deletes old routes from CIDR
func (*CIDRHandler) GenerateCIDRFromHostSubnet ¶
func (h *CIDRHandler) GenerateCIDRFromHostSubnet(def multinicv1.PluginConfig) (multinicv1.CIDRSpec, error)
GenerateCIDRFromHostSubnet generates CIDR from Host Subnet in the case that podCIDR must be shared with host subnet (e.g., in aws VPC)
func (*CIDRHandler) GetAllNetAddrs ¶
func (h *CIDRHandler) GetAllNetAddrs() []string
GetAllNetAddrs returns all common network address from hiflist
func (*CIDRHandler) GetCIDR ¶
func (h *CIDRHandler) GetCIDR(name string) (*multinicv1.CIDR, error)
GetCIDR gets CIDR from CIDR name
func (*CIDRHandler) GetCache ¶
func (h *CIDRHandler) GetCache(key string) (multinicv1.CIDRSpec, error)
func (*CIDRHandler) GetHostAddressesToExclude ¶
func (h *CIDRHandler) GetHostAddressesToExclude() []string
GetHostAddressesToExclude returns host addresses to be excluded in the case that dedicated podCIDR must be shared with host subnet (e.g., in aws VPC)
func (*CIDRHandler) GetHostInterfaceIndexMap ¶
func (h *CIDRHandler) GetHostInterfaceIndexMap(entries []multinicv1.CIDREntry) map[string]map[int]multinicv1.HostInterfaceInfo
GetHostInterfaceIndexMap finds a map from (host name, interface index) to HostInterfaceInfo of CIDR
func (*CIDRHandler) GetSyncAllocations ¶
func (h *CIDRHandler) GetSyncAllocations(ippool multinicv1.IPPoolSpec, allocationMap map[string]map[string]multinicv1.Allocation, crAllocationMap map[string]map[string]multinicv1.Allocation) (bool, []multinicv1.Allocation)
func (*CIDRHandler) InitCustomCRCache ¶
func (h *CIDRHandler) InitCustomCRCache()
InitCustomCRCache inits existing list of IPPool and HostInterface to avoid unexpected recomputation of CIDR
func (*CIDRHandler) IsL3Mode ¶
func (h *CIDRHandler) IsL3Mode(def multinicv1.PluginConfig) bool
IsL3Mode checkes L3 VLAN mode (to add/delete L3 routes automatically)
func (*CIDRHandler) ListCIDR ¶
func (h *CIDRHandler) ListCIDR() (map[string]multinicv1.CIDR, error)
ListCIDR returns a map from CIDR name to instance
func (*CIDRHandler) ListCache ¶
func (h *CIDRHandler) ListCache() map[string]multinicv1.CIDRSpec
func (*CIDRHandler) NewCIDR ¶
func (h *CIDRHandler) NewCIDR(def multinicv1.PluginConfig, namespace string) (multinicv1.CIDRSpec, error)
NewCIDR returns new CIDR from PluginConfig
func (*CIDRHandler) NewCIDRWithNewConfig ¶
func (h *CIDRHandler) NewCIDRWithNewConfig(def multinicv1.PluginConfig, namespace string) (bool, error)
NewCIDRWithNewConfig creates new CIDR by computing interface indexes from master networks
func (*CIDRHandler) ProcessUpdateRequest ¶
func (h *CIDRHandler) ProcessUpdateRequest()
ProcessUpdateRequest modifies existing CIDR from the new HostInterface information
func (*CIDRHandler) SetCache ¶
func (h *CIDRHandler) SetCache(key string, value multinicv1.CIDRSpec)
handling CIDRCache
func (*CIDRHandler) SyncAllPendingCustomCR ¶
func (h *CIDRHandler) SyncAllPendingCustomCR(defHandler *plugin.NetAttachDefHandler)
SyncAllPendingCustomCR sync CIDRs and IPPools corresponding to MultiNICNetwork note: CIDR name = NetworkAttachmentDefinition name
func (*CIDRHandler) SyncCIDRRoute ¶
func (h *CIDRHandler) SyncCIDRRoute(cidrSpec multinicv1.CIDRSpec, forceDelete bool) (status multinicv1.RouteStatus)
SyncCIDRRoute try adding routes by CIDR
func (*CIDRHandler) SyncIPPoolWithActivePods ¶
func (h *CIDRHandler) SyncIPPoolWithActivePods(cidrMap map[string]multinicv1.CIDR, ippoolSnapshot map[string]multinicv1.IPPoolSpec)
SyncIPPoolWithActivePods adds assigned IP to the IPPool and reported unsync IPs
func (*CIDRHandler) UpdateCIDRs ¶
func (h *CIDRHandler) UpdateCIDRs()
UpdateCIDR adds ticket to activate ProcessUpdateRequest
func (*CIDRHandler) UpdateEntries ¶
func (h *CIDRHandler) UpdateEntries(cidrSpec multinicv1.CIDRSpec, excludes []compute.IPValue, changed bool) (map[string]multinicv1.CIDREntry, bool)
UpdateEntries updates CIDR entry from current HostInterfaceCache
type CIDRReconciler ¶
type CIDRReconciler struct { client.Client *CIDRHandler *DaemonWatcher Scheme *runtime.Scheme }
CIDRReconciler reconciles a CIDR object - if CIDR is deleted, delete CIDR dependency (ippools, routes) - otherwise, update CIDR
func (*CIDRReconciler) SetupWithManager ¶
func (r *CIDRReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type ConfigReconciler ¶
type ConfigReconciler struct { client.Client *kubernetes.Clientset *rest.Config *CIDRHandler *plugin.NetAttachDefHandler Scheme *runtime.Scheme }
func (*ConfigReconciler) CreateDefaultDaemonConfig ¶
func (r *ConfigReconciler) CreateDefaultDaemonConfig() error
func (*ConfigReconciler) SetupWithManager ¶
func (r *ConfigReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
func (*ConfigReconciler) UpdateConfigBySpec ¶
func (r *ConfigReconciler) UpdateConfigBySpec(spec *multinicv1.ConfigSpec)
UpdateConfigBySpec updates configuration variables defined in the spec
type DaemonCacheHandler ¶
type DaemonCacheHandler struct {
*SafeCache
}
func (*DaemonCacheHandler) GetCache ¶
func (h *DaemonCacheHandler) GetCache(key string) (DaemonPod, error)
func (*DaemonCacheHandler) ListCache ¶
func (h *DaemonCacheHandler) ListCache() map[string]DaemonPod
func (*DaemonCacheHandler) SetCache ¶
func (h *DaemonCacheHandler) SetCache(key string, value DaemonPod)
type DaemonConnector ¶
type DaemonConnector struct {
*kubernetes.Clientset
}
func (DaemonConnector) ApplyL3Config ¶
func (dc DaemonConnector) ApplyL3Config(podAddress string, cidrName string, subnet string, routes []HostRoute, forceDelete bool) (RouteUpdateResponse, error)
AddRoute sends a request to add a new route to specific host
func (DaemonConnector) DeleteL3Config ¶
func (dc DaemonConnector) DeleteL3Config(podAddress string, cidrName string, subnet string) (RouteUpdateResponse, error)
DeleteRoute sends a request to delete the route from specific host
func (DaemonConnector) GetInterfaces ¶
func (dc DaemonConnector) GetInterfaces(podAddress string) ([]multinicv1.InterfaceInfoType, error)
GetInterfaces returns HostInterface of specific host
func (DaemonConnector) Join ¶
func (dc DaemonConnector) Join(podAddress string, hifs []multinicv1.InterfaceInfoType) error
Join notifies new daemon to get knowing the existing daemons on the other hosts
type DaemonWatcher ¶
type DaemonWatcher struct { *kubernetes.Clientset PodQueue chan *v1.Pod Quit chan struct{} *HostInterfaceHandler *DaemonCacheHandler }
DaemonWatcher watches daemon pods and updates HostInterface and CIDR
func NewDaemonWatcher ¶
func NewDaemonWatcher(client client.Client, config *rest.Config, hostInterfaceHandler *HostInterfaceHandler, daemonCacheHandler *DaemonCacheHandler, podQueue chan *v1.Pod, quit chan struct{}) *DaemonWatcher
NewDaemonWatcher creates new daemon watcher
func (*DaemonWatcher) IsDaemonSetReady ¶
func (w *DaemonWatcher) IsDaemonSetReady() bool
func (*DaemonWatcher) ProcessPodQueue ¶
func (w *DaemonWatcher) ProcessPodQueue()
ProcessPodQueue creates HostInterface when daemon is not going to be terminated
deletes HostInterface if daemon is deleted updates CIDR according to the change
func (*DaemonWatcher) Run ¶
func (w *DaemonWatcher) Run()
Run executes daemon watcher routine until get quit signal
func (*DaemonWatcher) TryGetDaemonPod ¶
func (w *DaemonWatcher) TryGetDaemonPod(nodeName string) (DaemonPod, error)
TryGetDaemonPod tries getting daemon pod from cache or API server
func (*DaemonWatcher) UpdateCurrentList ¶
func (w *DaemonWatcher) UpdateCurrentList() error
UpdateCurrentList puts existing daemon pods to the process queue
type HostInterfaceHandler ¶
type HostInterfaceHandler struct { *kubernetes.Clientset client.Client *SafeCache DaemonConnector }
HostInterfaceHandler handles HostInterface object - general handling: Get, List, Delete
func NewHostInterfaceHandler ¶
func NewHostInterfaceHandler(config *rest.Config, client client.Client) *HostInterfaceHandler
NewHostInterfaceHandler
func (*HostInterfaceHandler) CreateHostInterface ¶
func (h *HostInterfaceHandler) CreateHostInterface(hostName string, interfaces []multinicv1.InterfaceInfoType) error
CreateHostInterface creates new HostInterface from an interface list get from daemon pods
func (*HostInterfaceHandler) DeleteHostInterface ¶
func (h *HostInterfaceHandler) DeleteHostInterface(name string) error
DeleteHostInterface deletes HostInterface from hostname
func (*HostInterfaceHandler) GetCache ¶
func (h *HostInterfaceHandler) GetCache(key string) (multinicv1.HostInterface, error)
func (*HostInterfaceHandler) GetHostInterface ¶
func (h *HostInterfaceHandler) GetHostInterface(name string) (*multinicv1.HostInterface, error)
GetHostInterface gets HostInterface from hostname
func (*HostInterfaceHandler) GetInfoAvailableSize ¶
func (h *HostInterfaceHandler) GetInfoAvailableSize() int
func (*HostInterfaceHandler) IpamJoin ¶
func (h *HostInterfaceHandler) IpamJoin(daemon DaemonPod) error
ipamJoin calls daemon to greet the existing hosts by referring to HostInterface list
func (*HostInterfaceHandler) ListCache ¶
func (h *HostInterfaceHandler) ListCache() map[string]multinicv1.HostInterface
func (*HostInterfaceHandler) ListHostInterface ¶
func (h *HostInterfaceHandler) ListHostInterface() (map[string]multinicv1.HostInterface, error)
ListHostInterface returns a map from hostname to HostInterface
func (*HostInterfaceHandler) SetCache ¶
func (h *HostInterfaceHandler) SetCache(key string, value multinicv1.HostInterface)
func (*HostInterfaceHandler) UpdateHostInterface ¶
func (h *HostInterfaceHandler) UpdateHostInterface(oldObj multinicv1.HostInterface, interfaces []multinicv1.InterfaceInfoType) (*multinicv1.HostInterface, error)
UpdateHostInterface updates HostInterface
type HostInterfaceReconciler ¶
type HostInterfaceReconciler struct { client.Client Scheme *runtime.Scheme *DaemonWatcher *HostInterfaceHandler *CIDRHandler }
HostInterfaceReconciler reconciles a HostInterface object - if HostInterface is deleted, re-process daemon pods
func (*HostInterfaceReconciler) CallFinalizer ¶
func (r *HostInterfaceReconciler) CallFinalizer(reqLogger logr.Logger, instance *multinicv1.HostInterface) error
CallFinalizer updates CIDRs
func (*HostInterfaceReconciler) SetupWithManager ¶
func (r *HostInterfaceReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
func (*HostInterfaceReconciler) UpdateInterfaces ¶
func (r *HostInterfaceReconciler) UpdateInterfaces(instance multinicv1.HostInterface) error
type HostRoute ¶
type HostRoute struct { Subnet string `json:"net"` NextHop string `json:"via"` InterfaceName string `json:"iface"` }
HostRoute defines a route
type IPAMInfo ¶
type IPAMInfo struct {
HIFList []multinicv1.InterfaceInfoType `json:"hifs"`
}
IPAMInfo defines information about HostInterface sent to daemon for greeting
type IPPoolHandler ¶
IPPoolHandler handles IPPool object - general handling: Get, List, Delete - update IPPool according to CIDR
func (*IPPoolHandler) AddLabel ¶
func (h *IPPoolHandler) AddLabel(ippool *multinicv1.IPPool) error
func (*IPPoolHandler) DeleteIPPool ¶
func (h *IPPoolHandler) DeleteIPPool(netAttachDef string, podCIDR string) error
DeleteIPPool deletes IPPool if exists
func (*IPPoolHandler) GetCache ¶
func (h *IPPoolHandler) GetCache(key string) (multinicv1.IPPoolSpec, error)
func (*IPPoolHandler) GetIPPool ¶
func (h *IPPoolHandler) GetIPPool(name string) (*multinicv1.IPPool, error)
GetIPPool gets IPPool from IPPool name
func (*IPPoolHandler) GetIPPoolName ¶
func (h *IPPoolHandler) GetIPPoolName(netAttachDef string, podCIDR string) string
GetIPPoolName returns IPPool name = <NetworkAttachmentDefinition name> - <Pod CIDR IP> - <Pod CIDR block>
func (*IPPoolHandler) ListCache ¶
func (h *IPPoolHandler) ListCache() map[string]multinicv1.IPPoolSpec
func (*IPPoolHandler) ListIPPool ¶
func (h *IPPoolHandler) ListIPPool() (map[string]multinicv1.IPPool, error)
ListIPPool returns a map from IPPool name to IPPool
func (*IPPoolHandler) PatchIPPoolAllocations ¶
func (h *IPPoolHandler) PatchIPPoolAllocations(ippoolName string, newAllocations []multinicv1.Allocation) error
func (*IPPoolHandler) SetCache ¶
func (h *IPPoolHandler) SetCache(key string, value multinicv1.IPPoolSpec)
func (*IPPoolHandler) UpdateIPPool ¶
func (h *IPPoolHandler) UpdateIPPool(netAttachDef string, podCIDR string, vlanCIDR string, hostName string, interfaceName string, excludes []compute.IPValue) error
UpdateIPPool creates or updates IPPool from:
- network config: NetworkAttachmentDefinition name, excluded CIDR ranges
- VLAN CIDR: PodCIDR, vlanCIDR
- host-interface information: host name, interface name
IPPool name is composed of NetworkAttachmentDefinition name and PodCIDR
func (*IPPoolHandler) UpdateIPPools ¶
func (h *IPPoolHandler) UpdateIPPools(defName string, entries []multinicv1.CIDREntry, excludes []compute.IPValue)
type IPPoolReconciler ¶
type IPPoolReconciler struct { client.Client Scheme *runtime.Scheme *CIDRHandler }
IPPoolReconciler reconciles a IPPool object - if IPPool is deleted, delete corresponding routes
func (*IPPoolReconciler) SetupWithManager ¶
func (r *IPPoolReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type L3ConfigRequest ¶
type L3ConfigRequest struct { Name string `json:"name"` Subnet string `json:"subnet"` Routes []HostRoute `json:"routes"` Force bool `json:"force"` }
L3 Configuration defines request of l3 route configuration
type MultiNicNetworkHandler ¶
type MultiNicNetworkHandler struct { client.Client sync.Mutex *SafeCache // contains filtered or unexported fields }
MultiNicNetworkHandler handles MultiNicNetwork object - update MultiNicNetwork status according to CIDR results
func (*MultiNicNetworkHandler) FilterNetworksByNamespace ¶
func (h *MultiNicNetworkHandler) FilterNetworksByNamespace(target string) []multinicv1.MultiNicNetwork
func (*MultiNicNetworkHandler) GetNetwork ¶
func (h *MultiNicNetworkHandler) GetNetwork(name string) (*multinicv1.MultiNicNetwork, error)
func (*MultiNicNetworkHandler) GetStatusCache ¶
func (h *MultiNicNetworkHandler) GetStatusCache(key string) (multinicv1.MultiNicNetworkStatus, error)
func (*MultiNicNetworkHandler) ListStatusCache ¶
func (h *MultiNicNetworkHandler) ListStatusCache() map[string]multinicv1.MultiNicNetworkStatus
func (*MultiNicNetworkHandler) SetCache ¶
func (h *MultiNicNetworkHandler) SetCache(key string, value multinicv1.MultiNicNetwork)
func (*MultiNicNetworkHandler) SyncAllStatus ¶
func (h *MultiNicNetworkHandler) SyncAllStatus(name string, spec multinicv1.CIDRSpec, routeStatus multinicv1.RouteStatus, daemonSize, infoAvailableSize int, cidrChange bool) (multinicv1.MultiNicNetworkStatus, error)
func (*MultiNicNetworkHandler) UpdateNetConfigStatus ¶
func (h *MultiNicNetworkHandler) UpdateNetConfigStatus(instance *multinicv1.MultiNicNetwork, netConfigStatus multinicv1.NetConfigStatus, message string) error
type MultiNicNetworkReconciler ¶
type MultiNicNetworkReconciler struct { client.Client *plugin.NetAttachDefHandler *CIDRHandler Scheme *runtime.Scheme PluginMap map[string]*PluginInterface }
MultiNicNetworkReconciler reconciles a MultiNicNetwork object
func (*MultiNicNetworkReconciler) GenerateNetAttachDef ¶
func (r *MultiNicNetworkReconciler) GenerateNetAttachDef(instance *multinicv1.MultiNicNetwork) error
func (*MultiNicNetworkReconciler) GetIPAMConfig ¶
func (r *MultiNicNetworkReconciler) GetIPAMConfig(instance *multinicv1.MultiNicNetwork) (*multinicv1.PluginConfig, error)
GetIPAMConfig get IPAM config from network definition
func (*MultiNicNetworkReconciler) GetMainPluginConf ¶
func (r *MultiNicNetworkReconciler) GetMainPluginConf(instance *multinicv1.MultiNicNetwork) (string, map[string]string, error)
func (*MultiNicNetworkReconciler) HandleMultiNicIPAM ¶
func (r *MultiNicNetworkReconciler) HandleMultiNicIPAM(instance *multinicv1.MultiNicNetwork) error
HandleMultiNicIPAM handles ipam if target type
func (*MultiNicNetworkReconciler) HandleNewNamespace ¶
func (r *MultiNicNetworkReconciler) HandleNewNamespace(namespace string)
HandleNewNamespace handles new namespace - generate NAD
func (*MultiNicNetworkReconciler) SetupWithManager ¶
func (r *MultiNicNetworkReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type NamespaceWatcher ¶
type NamespaceWatcher struct { *kubernetes.Clientset NamespaceQueue chan string Quit chan struct{} *MultiNicNetworkReconciler }
NamespaceWatcher watches new namespace and generate net-attach-def
func NewNamespaceWatcher ¶
func NewNamespaceWatcher(client client.Client, config *rest.Config, multinicnetworkReconciler *MultiNicNetworkReconciler, quit chan struct{}) *NamespaceWatcher
NewNamespaceWatcher creates new namespace watcher
func (*NamespaceWatcher) ProcessNamespaceQueue ¶
func (w *NamespaceWatcher) ProcessNamespaceQueue()
func (*NamespaceWatcher) Run ¶
func (w *NamespaceWatcher) Run()
Run executes namespace watcher routine until get quit signal
type PluginInterface ¶
type RouteHandler ¶
type RouteHandler struct { DaemonConnector *DaemonCacheHandler }
RouteHandler handles routes according to CIDR by connecting DaemonConnector
func (*RouteHandler) AddRoutes ¶
func (h *RouteHandler) AddRoutes(cidrSpec multinicv1.CIDRSpec, entries []multinicv1.CIDREntry, hostInterfaceInfoMap map[string]map[int]multinicv1.HostInterfaceInfo, forceDelete bool) (success bool, noConnection bool)
AddRoutes add corresponding routes of CIDR success: all routes is properly updated
func (*RouteHandler) AddRoutesToHost ¶
func (h *RouteHandler) AddRoutesToHost(cidrSpec multinicv1.CIDRSpec, hostName string, daemon DaemonPod, entries []multinicv1.CIDREntry, hostInterfaceInfoMap map[string]map[int]multinicv1.HostInterfaceInfo, forceDelete bool) (bool, bool)
AddRoutesToHost add route to a specific host
func (*RouteHandler) DeleteRoutes ¶
func (h *RouteHandler) DeleteRoutes(cidrSpec multinicv1.CIDRSpec)
DeleteRoutes deletes corresponding routes of CIDR
type RouteUpdateResponse ¶
RouteUpdateResponse defines response from adding/deleting routes
type SafeCache ¶
type SafeCache struct {
// contains filtered or unexported fields
}
func InitSafeCache ¶
func InitSafeCache() *SafeCache
func (*SafeCache) UnsetCache ¶
Source Files ¶
- cidr_controller.go
- cidr_handler.go
- config_controller.go
- daemon_cache_handler.go
- daemon_connector.go
- daemon_watcher.go
- hostinterface_controller.go
- hostinterface_handler.go
- ippool_controller.go
- ippool_handler.go
- multinicnetwork_controller.go
- multinicnetwork_handler.go
- namespace_watcher.go
- route_handler.go
- safe_cache_handler.go
- synchronizer.go