From 5da7496476a8a336b6ee18b7bc54036045704370 Mon Sep 17 00:00:00 2001 From: Tobias <22522058+sirkrypt0@users.noreply.github.com> Date: Tue, 31 Oct 2023 07:01:52 +0100 Subject: [PATCH] Add Layer 2 forwarding for subnet ports again (#3300) This feature has been added previously, but fallen victim to a refactoring that removed it. We now add it back again. Signed-off-by: Tobias Kantusch --- pkg/controller/pod.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/controller/pod.go b/pkg/controller/pod.go index 6896e19b37d..a3cc9fc0fd9 100644 --- a/pkg/controller/pod.go +++ b/pkg/controller/pod.go @@ -702,6 +702,14 @@ func (c *Controller) reconcileAllocateSubnets(cachedPod, pod *v1.Pod, needAlloca return nil, err } + if pod.Annotations[fmt.Sprintf(util.Layer2ForwardAnnotationTemplate, podNet.ProviderName)] == "true" { + if err := c.OVNNbClient.EnablePortLayer2forward(portName); err != nil { + c.recorder.Eventf(pod, v1.EventTypeWarning, "SetOVNPortL2ForwardFailed", err.Error()) + klog.Errorf("%v", err) + return nil, err + } + } + if portSecurity { sgNames := strings.Split(securityGroupAnnotation, ",") for _, sgName := range sgNames {