Skip to content

Commit 50899e2

Browse files
committed
Implement IPsec NAT-Traversal encapsulation option
This commit consumes configuration parameters for the IPsec `Full` mode, it currently has encapsulation option to configure OVN so that inter pod traffic across node are encapsulated to handle NAT traversal. So it implements the following. 1. When the encapsulation option is set with "Always", then enforce NAT-T encapsulation on the OVN. 2. When the encapsulation option is set with "Auto" or the config option for full mode is never set, then it continues to render the "auto" option for NAT-T encapsulation. 3. On the IBMCloud platform, NAT-T encapsulation is always enforced. Signed-off-by: Periyasamy Palanisamy <[email protected]>
1 parent 720212f commit 50899e2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

bindata/network/ovn-kubernetes/common/008-script-lib.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,15 @@ data:
326326
local ipsec_encapsulation=false
327327
{{ if .OVNIPsecEnable }}
328328
ipsec=true
329+
# Check for rendered IPsec encapsulation type, if it's set with "Always",
330+
# then force NAT-T encapsulation option on the OVN.
331+
{{ if eq .OVNIPsecEncap "Always" }}
332+
ipsec_encapsulation=true
333+
{{ end }}
329334
# IBMCloud does not forward ESP (IP proto 50)
330335
# Instead, force IBMCloud IPsec to always use NAT-T
336+
# So for IBMCloud, NAT-T will be set irrespective of whatever
337+
# value set in the .OVNIPsecEncap parameter.
331338
if [ "{{.PlatformType}}" == "IBMCloud" ]; then
332339
ipsec_encapsulation=true
333340
fi

pkg/network/ovn_kubernetes.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ func renderOVNKubernetes(conf *operv1.NetworkSpec, bootstrapResult *bootstrap.Bo
293293
data.Data["OVNIPsecDaemonsetEnable"] = OVNIPsecDaemonsetEnable
294294
data.Data["OVNIPsecEnable"] = OVNIPsecEnable
295295
data.Data["IPsecServiceCheckOnHost"] = renderIPsecHostDaemonSet && renderIPsecContainerizedDaemonSet
296+
data.Data["OVNIPsecEncap"] = operv1.EncapsulationAuto
297+
if OVNIPsecEnable && c.IPsecConfig.Full != nil {
298+
data.Data["OVNIPsecEncap"] = c.IPsecConfig.Full.Encapsulation
299+
}
296300

297301
klog.V(5).Infof("IPsec: is MachineConfig enabled: %v, is East-West DaemonSet enabled: %v", data.Data["IPsecMachineConfigEnable"], data.Data["OVNIPsecDaemonsetEnable"])
298302

0 commit comments

Comments
 (0)