Skip to content

Commit

Permalink
Allow setting loopback as direct routing device in Cilium 1.15+
Browse files Browse the repository at this point in the history
  • Loading branch information
robertvolkmann committed May 10, 2024
1 parent c96029d commit 5a0155f
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 2 deletions.
12 changes: 12 additions & 0 deletions hack/api-reference/cilium.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ int
</tr>
<tr>
<td>
<code>directRoutingDevice</code></br>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>DirectRoutingDevice the device using for direct routing between Cilium nodes</p>
</td>
</tr>
<tr>
<td>
<code>loadBalancingMode</code></br>
<em>
<a href="#cilium.networking.extensions.gardener.cloud/v1alpha1.LoadBalancingMode">
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/cilium/types_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ type NetworkConfig struct {
MTU *int
// Devices is the list of devices facing cluster/external network
Devices []string
// DirectRoutingDevice the device using for direct routing between Cilium nodes
DirectRoutingDevice *string
// LoadBalancingMode configuration, it should be 'snat', 'dsr' or 'hybrid'
LoadBalancingMode *LoadBalancingMode
// IPv4NativeRoutingCIDRMode will set the ipv4 native routing cidr from the network configs node's cidr if enabled.
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/cilium/v1alpha1/types_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ type NetworkConfig struct {
// Devices is the list of devices facing cluster/external network
// +optional
Devices []string `json:"devices,omitempty"`
// DirectRoutingDevice the device using for direct routing between Cilium nodes
// +optional
DirectRoutingDevice *string `json:"directRoutingDevice,omitempty"`
// LoadBalancingMode configuration, it should be 'snat', 'dsr' or 'hybrid'
// +optional
LoadBalancingMode *LoadBalancingMode `json:"loadBalancingMode,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/cilium/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/cilium/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/apis/cilium/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pkg/charts/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ type hubble struct {
// nodePort enablement for cilium
type nodePort struct {
// Nodeport Enabled is used to define whether Nodeport is required or not.
Enabled bool `json:"enabled"`
Mode ciliumv1alpha1.NodePortMode `json:"mode"`
Enabled bool `json:"enabled"`
Mode ciliumv1alpha1.NodePortMode `json:"mode"`
DirectRoutingDevice string `json:"directRoutingDevice"`
}

// operator configuration for cilium
Expand Down
4 changes: 4 additions & 0 deletions pkg/charts/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ func generateChartValues(config *ciliumv1alpha1.NetworkConfig, network *extensio
globalConfig.Devices = config.Devices
}

if config.DirectRoutingDevice != nil {
globalConfig.NodePort.DirectRoutingDevice = *config.DirectRoutingDevice
}

// check if load balancing mode is set
if config.LoadBalancingMode != nil {
globalConfig.BPF = bpf{
Expand Down

0 comments on commit 5a0155f

Please sign in to comment.