github.com/cilium/cilium@v1.16.2/pkg/datapath/tunnel/cell.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package tunnel 5 6 import ( 7 "github.com/cilium/hive/cell" 8 9 "github.com/cilium/cilium/pkg/defaults" 10 "github.com/cilium/cilium/pkg/option" 11 ) 12 13 // Cell is a cell that provides the parameters for the Cilium tunnel, 14 // based on user configuration and requests from external modules. 15 var Cell = cell.Module( 16 "datapath-tunnel-config", 17 "Tunneling configurations", 18 19 cell.Config(userCfg{TunnelProtocol: defaults.TunnelProtocol}), 20 21 cell.Provide( 22 newConfig, 23 24 // Provide the datapath options. 25 Config.datapathConfigProvider, 26 27 // Enable tunnel configuration when it is the primary routing mode. 28 func(dcfg *option.DaemonConfig) EnablerOut { 29 return NewEnabler(dcfg.TunnelingEnabled()) 30 }, 31 32 // Enable tunnel configuration when DSR Geneve is enabled (this is currently 33 // handled here, as the corresponding logic has not yet been modularized). 34 func(dcfg *option.DaemonConfig) EnablerOut { 35 return NewEnabler( 36 (dcfg.EnableNodePort || 37 dcfg.KubeProxyReplacement == option.KubeProxyReplacementTrue) && 38 dcfg.LoadBalancerUsesDSR() && 39 dcfg.LoadBalancerDSRDispatch == option.DSRDispatchGeneve, 40 // The datapath logic takes care of the MTU overhead. So no need to 41 // take it into account here. 42 // See encap_geneve_dsr_opt[4,6] in nodeport.h 43 WithoutMTUAdaptation(), 44 ) 45 }, 46 47 // Enable tunnel configuration when High Scale IPCache is enabled (this is 48 // currently handled here, as the corresponding logic has not yet been modularized). 49 func(dcfg *option.DaemonConfig) EnablerOut { 50 return NewEnabler(dcfg.EnableHighScaleIPcache) 51 }, 52 ), 53 )